cpp/cpp05/ex02/RobotomyRequestForm.cpp
2022-08-06 11:04:32 +02:00

52 lines
1.8 KiB
C++

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* RobotomyRequestForm.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/08/04 15:14:32 by apommier #+# #+# */
/* Updated: 2022/08/05 16:14:19 by apommier ### ########.fr */
/* */
/* ************************************************************************** */
#include "RobotomyRequestForm.hpp"
#include <cstdlib>
RobotomyRequestForm::RobotomyRequestForm() : AForm(72, 45, "RobotomyRequestForm")
{
this->_target = "Unknow Target";
}
RobotomyRequestForm::RobotomyRequestForm(std::string target) : AForm(72, 45, "RobotomyRequestForm")
{
this->_target = target;
}
RobotomyRequestForm::RobotomyRequestForm(const RobotomyRequestForm& copy) : AForm(copy)
{
*this = copy;
}
RobotomyRequestForm::~RobotomyRequestForm()
{
}
RobotomyRequestForm &RobotomyRequestForm::operator=(const RobotomyRequestForm& rhs)
{
if (&rhs != this)
this->_target = rhs._target;
return (*this);
}
void RobotomyRequestForm::execute(Bureaucrat const & executor) const
{
AForm::checkExecution(executor);
std::cout << "Brrrzrzrzrzzrzrzzrrzz...\n";
std::srand(time(NULL));
if (std::rand() % 2)
std::cout << this->_target << " has been robotomized\n";
else
std::cout << this->_target << " hasn't been robtomized\n";
}