aboutsummaryrefslogtreecommitdiff
path: root/cpp05/ex02/RobotomyRequestForm.cpp
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2020-11-17 13:52:48 +0100
committerCharles Cabergs <me@cacharle.xyz>2020-11-17 13:52:48 +0100
commit331c3596660fed6c8b04fdfd0a89435ccffaaf20 (patch)
tree4196c94d9084a3d0ed45f3ec798d713639cbfc8a /cpp05/ex02/RobotomyRequestForm.cpp
parent4eecb32ffcf48c42672782fbcd53781a22e95ebf (diff)
downloadpiscine_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.cpp38
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) {}