/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* RobotomyRequestForm.cpp :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: aortigos target = other.getTarget(); } //std::cout << "AForm copy assigment operator called" << std::endl; return (*this); } RobotomyRequestForm::~RobotomyRequestForm() { //std::cout << "Destructor called" } RobotomyRequestForm::RobotomyRequestForm(std::string target) : AForm("RobotomyRequestForm", 72, 45), target(target) { //std::cout << "AForm constructor with params called" << std::endl; } ////////////////// // Getters // ////////////////// std::string RobotomyRequestForm::getTarget() const { return (this->target); } ////////////////// // Execute // ////////////////// void RobotomyRequestForm::execute(Bureaucrat const &executor) const { if (!this->getIsSigned()) throw FormNotSignedException(); if (this->getGradeToExecute() < executor.getGrade()) throw AForm::GradeTooLowException(); // RobotomyRequestForm form action... std::cout << "**bzzzzzzzzz --- **drilling noises*" << std::endl; if (rand() % 2 == 0) { std::cout << this->target << " has been successfully robotomized" << std::endl; } else { std::cout << "Robotomization failed :(" << std::endl; } } ////////////////// // Exceptions // ////////////////// const char* RobotomyRequestForm::FormNotSignedException::what() const throw() { return ("form is not signed."); }