1
0

」 feat: finished ex02

This commit is contained in:
2025-04-03 14:34:21 +02:00
parent 9e85ca79d9
commit bb8d13b9ed
13 changed files with 238 additions and 22 deletions

View File

@ -0,0 +1,53 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* RobotomyRequestForm.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/04/03 09:19:30 by adjoly #+# #+# */
/* Updated: 2025/04/03 14:17:12 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
#include "RobotomyRequestForm.hpp"
#include "Bureaucrat.hpp"
#include <cstdlib>
RobotomyRequestForm::RobotomyRequestForm(void)
: AForm("RobotomyRequestForm", 72, 45) {
_log("", "RobotomyRequestForm", "", "default constructor called");
}
RobotomyRequestForm::RobotomyRequestForm(const RobotomyRequestForm &cpy) : AForm(cpy) {
_log("", "RobotomyRequestForm", "", "copy constructor called");
if (this != &cpy)
*this = cpy;
}
RobotomyRequestForm::RobotomyRequestForm(std::string &target)
: AForm(target, 72, 45) {
_log("", "RobotomyRequestForm", "", "target constructor called");
}
RobotomyRequestForm::~RobotomyRequestForm(void) {
_log("", "RobotomyRequestForm", "", "destructor called");
}
RobotomyRequestForm &RobotomyRequestForm::operator=(const RobotomyRequestForm &cpy) {
_log("", "RobotomyRequestForm", "", "copy assignement constructor called");
(void)cpy;
return *this;
}
void RobotomyRequestForm::_exec(const Bureaucrat &b) const {
std::cout << "Drilingg noisseeeeeeee !!!" << std::endl;
std::srand(time(0));
if (std::rand() % 2) {
std::cout << b.getName() << " has been robotomized successfully ! :D" << std::endl;
} else {
std::cout << b.getName() << " robotomization failed 😿" << std::endl;
}
}