Files
cpp05/ex02/RobotomyRequestForm.cpp
2025-08-02 13:51:40 +02:00

43 lines
1.3 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#include "RobotomyRequestForm.hpp"
#include "Bureaucrat.hpp"
#include <cstdlib>
RobotomyRequestForm::RobotomyRequestForm(void): AForm("RobotomyRequestForm", 72, 45) {
_log("", "RobotomyRequestForm", "", "default constructor called");
std::srand(time(0));
}
RobotomyRequestForm::RobotomyRequestForm(const RobotomyRequestForm &cpy) : AForm(cpy) {
_log("", "RobotomyRequestForm", "", "copy constructor called");
std::srand(time(0));
if (this != &cpy)
*this = cpy;
}
RobotomyRequestForm::RobotomyRequestForm(std::string target): AForm(target, 72, 45) {
_log("", "RobotomyRequestForm", "", "target constructor called");
std::srand(time(0));
}
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 {
(void) b;
std::cout << "Driling noise or smth idk" << std::endl;
if (std::rand() % 2) {
std::cout << this->getName() << " has been robotomised successfully ! :D" << std::endl;
} else {
std::cout << this->getName() << " robotomisation failed D:" << std::endl;
}
}