cpp01...
This commit is contained in:
58
ex05/Harl/Harl.cpp
Normal file
58
ex05/Harl/Harl.cpp
Normal file
@@ -0,0 +1,58 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* Harl.hpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/09/06 02:27:27 by aortigos #+# #+# */
|
||||
/* Updated: 2025/09/06 02:28:09 by aortigos ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "Harl.hpp"
|
||||
|
||||
void Harl::debug( void )
|
||||
{
|
||||
std::cout << "I love having extra bacon for my 7XL-double-cheese-triple-pickle-specialketchup burger. I really do!";
|
||||
std::cout << std::endl;
|
||||
}
|
||||
|
||||
void Harl::info( void )
|
||||
{
|
||||
std::cout << "I cannot believe adding extra bacon costs more money. You didn’t put enough bacon in my burger! If you did, I wouldn’t be asking for more!";
|
||||
std::cout << std::endl;
|
||||
}
|
||||
|
||||
void Harl::warning( void )
|
||||
{
|
||||
std::cout << "I think I deserve to have some extra bacon for free. I’ve been coming for years, whereas you started working here just last month.";
|
||||
std::cout << std::endl;
|
||||
}
|
||||
|
||||
void Harl::error( void )
|
||||
{
|
||||
std::cout << "This is unacceptable! I want to speak to the manager now.";
|
||||
std::cout << std::endl;
|
||||
}
|
||||
|
||||
void Harl::complain( std::string level )
|
||||
{
|
||||
int i;
|
||||
typedef void (Harl::*HarlFunc)();
|
||||
|
||||
i = 0;
|
||||
std::string levels[]= {"DEBUG", "INFO", "WARNING", "ERROR"};
|
||||
HarlFunc funcs[] = { &Harl::debug, &Harl::info, &Harl::warning, &Harl::error};
|
||||
|
||||
while (i < 4)
|
||||
{
|
||||
if (level == levels[i])
|
||||
{
|
||||
(this->*funcs[i])();
|
||||
break ;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user