RobotomyRequestForm.cpp 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /* ************************************************************************** */
  2. /* */
  3. /* ::: :::::::: */
  4. /* RobotomyRequestForm.cpp :+: :+: :+: */
  5. /* +:+ +:+ +:+ */
  6. /* By: bchanot <bchanot@42.fr> +#+ +:+ +#+ */
  7. /* +#+#+#+#+#+ +#+ */
  8. /* Created: 2025/12/30 15:05:32 by bchanot #+# #+# */
  9. /* Updated: 2025/12/31 16:05:19 by bchanot ### ########.fr */
  10. /* */
  11. /* ************************************************************************** */
  12. #include "RobotomyRequestForm.hpp"
  13. #include <cstdlib>
  14. #include <ctime>
  15. /*
  16. ** ------------------------------- CONSTRUCTOR --------------------------------
  17. */
  18. RobotomyRequestForm::RobotomyRequestForm() : AForm("RobotomyRequestForm", 45, 72, "DefaultTarget")
  19. {
  20. }
  21. RobotomyRequestForm::RobotomyRequestForm( const std::string & target ) : AForm("RobotomyRequestForm", 45, 72, target)
  22. {
  23. }
  24. RobotomyRequestForm::RobotomyRequestForm( const RobotomyRequestForm & src ) : AForm(src.getName(), src.getSignGrade(), src.getExecutionGrade(), src._target)
  25. {
  26. }
  27. /*
  28. ** -------------------------------- DESTRUCTOR --------------------------------
  29. */
  30. RobotomyRequestForm::~RobotomyRequestForm()
  31. {
  32. }
  33. /*
  34. ** --------------------------------- OVERLOAD ---------------------------------
  35. */
  36. RobotomyRequestForm & RobotomyRequestForm::operator=( RobotomyRequestForm const & rhs )
  37. {
  38. (void)rhs;
  39. //if ( this != &rhs )
  40. //{
  41. //this->_value = rhs.getValue();
  42. //}
  43. return *this;
  44. }
  45. std::ostream & operator<<( std::ostream & o, RobotomyRequestForm const & i )
  46. {
  47. i.print(o);
  48. return o;
  49. }
  50. /*
  51. ** --------------------------------- METHODS ----------------------------------
  52. */
  53. void RobotomyRequestForm::action(void) const {
  54. srand(time(0));
  55. if (rand() % 2)
  56. std::cout << "*biiip bup biip, dzz dzzzzz* " << this->_target << " has been robotized successfully" << std::endl;
  57. else
  58. std::cout << "Oh.. Robotizing " << this->_target << " failed ... try again" << std::endl;
  59. }
  60. /*
  61. ** --------------------------------- ACCESSOR ---------------------------------
  62. */
  63. /* ************************************************************************** */