44 lines
961 B
C++
44 lines
961 B
C++
#include "RobotomyRequestForm.hpp"
|
|
#include <string>
|
|
|
|
RobotomyRequestForm::RobotomyRequestForm() : AForm("RobotomyRequestForm", 72, 45), _target("default target")
|
|
{
|
|
}
|
|
|
|
RobotomyRequestForm::RobotomyRequestForm(const std::string target) : AForm("RobotomyRequestForm", 72, 45), _target(target)
|
|
{
|
|
}
|
|
|
|
RobotomyRequestForm::RobotomyRequestForm(const RobotomyRequestForm &other) : AForm(other)
|
|
{
|
|
*this = other;
|
|
}
|
|
|
|
RobotomyRequestForm &RobotomyRequestForm::operator=(const RobotomyRequestForm &other)
|
|
{
|
|
_target = other._target;
|
|
setIsSigned(other.getSigned());
|
|
return (*this);
|
|
}
|
|
|
|
RobotomyRequestForm::~RobotomyRequestForm()
|
|
{
|
|
}
|
|
|
|
void RobotomyRequestForm::performAction() const
|
|
{
|
|
int rdm;
|
|
|
|
rdm = rand() % 2;
|
|
|
|
if (rdm == 1)
|
|
std::cout << "Beep Boop" << getName() << " has been robotomized successfully." << std::endl;
|
|
else
|
|
throw RobotizationFailed();
|
|
}
|
|
|
|
const char *RobotomyRequestForm::RobotizationFailed::what() const throw()
|
|
{
|
|
return ("Robotomy failed.");
|
|
}
|