aboutsummaryrefslogtreecommitdiff
path: root/cpp05/ex03/RobotomyRequestForm.cpp
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2020-11-17 19:02:35 +0100
committerCharles Cabergs <me@cacharle.xyz>2020-11-17 19:02:35 +0100
commit452e6bfa7bb4bca75dc4659bf9d707101b411977 (patch)
treef4ee27a96437d6d17a89bbbbc135ae45f9f3faae /cpp05/ex03/RobotomyRequestForm.cpp
parenta92013c92bfcd50b0e2561280c9eaa604843ade0 (diff)
downloadpiscine_cpp-452e6bfa7bb4bca75dc4659bf9d707101b411977.tar.gz
piscine_cpp-452e6bfa7bb4bca75dc4659bf9d707101b411977.tar.bz2
piscine_cpp-452e6bfa7bb4bca75dc4659bf9d707101b411977.zip
Added cpp05/ex02 main, Added cpp05/ex03
Diffstat (limited to 'cpp05/ex03/RobotomyRequestForm.cpp')
-rw-r--r--cpp05/ex03/RobotomyRequestForm.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/cpp05/ex03/RobotomyRequestForm.cpp b/cpp05/ex03/RobotomyRequestForm.cpp
new file mode 100644
index 0000000..ed05d5f
--- /dev/null
+++ b/cpp05/ex03/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 17:20:03 by charles ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#include "RobotomyRequestForm.hpp"
+
+RobotomyRequestForm::RobotomyRequestForm(std::string const& target)
+ : Form("robotomy request", 72, 45), 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) {}