CPP05
1.0
読み取り中…
検索中…
一致する文字列を見つけられません
RobotomyRequestForm.cpp
[詳解]
1
/* ************************************************************************** */
2
/* */
3
/* ::: :::::::: */
4
/* RobotomyRequestForm.cpp :+: :+: :+: */
5
/* +:+ +:+ +:+ */
6
/* By: kamitsui <kamitsui@student.42tokyo.jp> +#+ +:+ +#+ */
7
/* +#+#+#+#+#+ +#+ */
8
/* Created: 2025/06/30 12:21:11 by kamitsui #+# #+# */
9
/* Updated: 2025/07/18 02:47:36 by kamitsui ### ########.fr */
10
/* */
11
/* ************************************************************************** */
12
18
#include "
RobotomyRequestForm.hpp
"
19
20
RobotomyRequestForm::RobotomyRequestForm(
const
std::string
&target) :
AForm
(
"Robotomy Request"
, 72, 45, target) {}
21
22
RobotomyRequestForm::RobotomyRequestForm(
const
RobotomyRequestForm
&other) :
AForm
(other) {}
23
24
RobotomyRequestForm
&
RobotomyRequestForm::operator=
(
const
RobotomyRequestForm
&other) {
25
AForm::operator=
(other);
26
return
*
this
;
27
}
28
29
RobotomyRequestForm::~RobotomyRequestForm
() {}
30
34
void
RobotomyRequestForm::performAction
()
const
{
35
std::cout
<<
"* VRRR... BZZZZT... CLANK! *"
<<
std::endl
;
36
if
(
std::rand
() % 2) {
37
std::cout
<<
getTarget
() <<
" has been successfully robotomized!"
<<
std::endl
;
38
}
else
{
39
std::cout
<<
"The robotomy on "
<<
getTarget
() <<
" has failed."
<<
std::endl
;
40
}
41
}
std::string
AForm
An abstract base class for forms.
Definition
AForm.hpp:34
AForm::getTarget
const std::string & getTarget() const
Definition
AForm.cpp:46
AForm::operator=
AForm & operator=(const AForm &other)
Definition
AForm.cpp:32
RobotomyRequestForm
A concrete form that simulates a robotomy attempt.
Definition
RobotomyRequestForm.hpp:28
RobotomyRequestForm::operator=
RobotomyRequestForm & operator=(const RobotomyRequestForm &other)
Definition
RobotomyRequestForm.cpp:24
RobotomyRequestForm::~RobotomyRequestForm
~RobotomyRequestForm()
Definition
RobotomyRequestForm.cpp:29
RobotomyRequestForm::performAction
virtual void performAction() const
Makes drilling noises and informs of a 50% successful robotomy.
Definition
RobotomyRequestForm.cpp:34
std::cout
std::endl
T endl(T... args)
RobotomyRequestForm.hpp
Defines the RobotomyRequestForm class.
std::rand
T rand(T... args)
ex02
RobotomyRequestForm.cpp
構築:
1.9.8