1
0
This repository has been archived on 2025-05-13. You can view files and clone it, but cannot push or open issues or pull requests.
Files
CPP_Module_05/ex02/RobotomyRequestForm.cpp
2025-04-03 16:07:05 +02:00

54 lines
2.1 KiB
C++
Raw Permalink 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.

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* RobotomyRequestForm.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/04/03 09:19:30 by adjoly #+# #+# */
/* Updated: 2025/04/03 16:02:35 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 robotomised successfully ! :D" << std::endl;
} else {
std::cout << b.getName() << " robotomisation failed 😿" << std::endl;
}
}