aboutsummaryrefslogtreecommitdiff
path: root/cpp05/ex02/RobotomyRequestForm.cpp
blob: 85c18c89f91c74cd3f6da466087140c82c89729c (plain)
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
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   RobotomyRequestForm.cpp                            :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: cacharle <me@cacharle.xyz>                 +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/10/19 13:45:45 by cacharle          #+#    #+#             */
/*   Updated: 2020/12/12 12:08:26 by cacharle         ###   ########.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
{
    std::cout << "DRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR" << std::endl;
    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) {}