42_CPP05/ex02/src/RobotomyRequestForm.cpp
Camille Chauvet 3990927c54 add: ex02
2023-09-11 16:18:29 +00:00

43 lines
990 B
C++

#include "RobotomyRequestForm.hpp"
#include "AForm.hpp"
#include <string>
#include <iostream>
RobotomyRequestForm::RobotomyRequestForm():
AForm("RobotomyRequestForm", 45, 72, "")
{
}
RobotomyRequestForm::RobotomyRequestForm(const std::string& target):
AForm("RobotomyRequestForm", 45, 72, target)
{
std::cout << "RobotomyRequestForm(" << target << ")" << std::endl;
}
RobotomyRequestForm::RobotomyRequestForm(const RobotomyRequestForm& src):
AForm(src)
{
std::cout << "RobotomyRequestForm(RobotomyRequestForm)" << std::endl;
}
RobotomyRequestForm& RobotomyRequestForm::operator=(const RobotomyRequestForm& src)
{
if (this != & src)
*this = src;
return *this;
}
void RobotomyRequestForm::execute(const Bureaucrat &exec) const
{
static bool ok(false);
std::cout << "Bzit bzit" << std::endl;
if (ok)
std::cout << this->_target << " be robotomized" << std::endl;
else
std::cout << this->_target << " robotomized failed" << std::endl;
ok = !ok;
AForm::execute(exec);
}