「✨」 feat: finished ex03
This commit is contained in:
53
ex03/RobotomyRequestForm.cpp
Normal file
53
ex03/RobotomyRequestForm.cpp
Normal 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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user