diff options
| author | Charles Cabergs <me@cacharle.xyz> | 2020-11-17 13:52:48 +0100 |
|---|---|---|
| committer | Charles Cabergs <me@cacharle.xyz> | 2020-11-17 13:52:48 +0100 |
| commit | 331c3596660fed6c8b04fdfd0a89435ccffaaf20 (patch) | |
| tree | 4196c94d9084a3d0ed45f3ec798d713639cbfc8a /cpp05/ex02/RobotomyRequestForm.cpp | |
| parent | 4eecb32ffcf48c42672782fbcd53781a22e95ebf (diff) | |
| download | piscine_cpp-331c3596660fed6c8b04fdfd0a89435ccffaaf20.tar.gz piscine_cpp-331c3596660fed6c8b04fdfd0a89435ccffaaf20.tar.bz2 piscine_cpp-331c3596660fed6c8b04fdfd0a89435ccffaaf20.zip | |
Fixing cpp05/ex00-02
Diffstat (limited to 'cpp05/ex02/RobotomyRequestForm.cpp')
| -rw-r--r-- | cpp05/ex02/RobotomyRequestForm.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/cpp05/ex02/RobotomyRequestForm.cpp b/cpp05/ex02/RobotomyRequestForm.cpp index e69de29..113bcd1 100644 --- a/cpp05/ex02/RobotomyRequestForm.cpp +++ b/cpp05/ex02/RobotomyRequestForm.cpp @@ -0,0 +1,38 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* RobotomyRequestForm.cpp :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cacharle <me@cacharle.xyz> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/10/19 13:45:45 by cacharle #+# #+# */ +/* Updated: 2020/11/17 13:27:05 by cacharle ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "RobotomyRequestForm.hpp" + +RobotomyRequestForm::RobotomyRequestForm(std::string const& target) + : Form("robotomy request", 145, 137), m_target(target) {} + +RobotomyRequestForm::RobotomyRequestForm(const RobotomyRequestForm& other) + : Form(other) { *this = other; } + +RobotomyRequestForm& RobotomyRequestForm::operator=(const RobotomyRequestForm& other) +{ + Form::operator=(other); + m_target = other.m_target; + return *this; +} + +RobotomyRequestForm::~RobotomyRequestForm() {} + +void RobotomyRequestForm::executeUnsafe() const +{ + if (rand() % 100 <= 50) + std::cout << m_target << " has successfully been robotomized" << std::endl; + else + std::cout << m_target << " couldn't be robotomized" << std::endl; +} + +RobotomyRequestForm::RobotomyRequestForm() : Form("", 0, 0) {} |
