-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathRobotomyRequestForm.cpp
More file actions
51 lines (42 loc) · 2.15 KB
/
Copy pathRobotomyRequestForm.cpp
File metadata and controls
51 lines (42 loc) · 2.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* RobotomyRequestForm.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dpoveda- <me@izenynn.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/02/18 01:58:17 by dpoveda- #+# #+# */
/* Updated: 2022/02/18 03:03:52 by dpoveda- ### ########.fr */
/* */
/* ************************************************************************** */
#include "RobotomyRequestForm.hpp"
#include <cstdlib>
#include <ctime>
RobotomyRequestForm::RobotomyRequestForm()
: Form("robotomy request", "none", 72, 45) {}
RobotomyRequestForm::RobotomyRequestForm(const std::string& target)
: Form("robotomy request", target, 72, 45) {
std::cout << "Robotomy Request Form created" << std::endl;
}
RobotomyRequestForm::RobotomyRequestForm(const RobotomyRequestForm& other)
: Form(other.getName(), other.getTarget(), other.getSignGrade(), other.getExecuteGrade()) {
*this = other;
std::cout << "Copy of Robotomy Request Form created" << std::endl;
}
RobotomyRequestForm::~RobotomyRequestForm() {
std::cout << "Robotomy Request Form destroyed" << std::endl;
}
RobotomyRequestForm& RobotomyRequestForm::operator=(const RobotomyRequestForm& other) {
std::cout << "Robotomy Request Form assignment operator" << std::endl;
if (this == &other) return *this;
return *this;
}
void RobotomyRequestForm::executeAction() const {
std::srand(std::time(NULL)); // use current time as seed for random generator
std::cout << "* SOME DRILLING NOISES *" << std::endl;
if (std::rand() % 2 == 0) {
std::cout << this->getTarget() << " has been robotomized succesfully" << std::endl;
} else {
std::cout << "Failed to robotomized " << this->getTarget() << std::endl;
}
}