aboutsummaryrefslogtreecommitdiff
path: root/cpp04/ex00/Sorcerer.cpp
blob: c6910ceb4fb55b218f1685f5880fea4f75753ad2 (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   Sorcerer.cpp                                       :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: charles <charles.cabergs@gmail.com>        +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/04/13 20:29:19 by charles           #+#    #+#             */
/*   Updated: 2020/04/13 20:49:48 by charles          ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#include "Sorcerer.hpp"

Sorcerer::Sorcerer(std::string name, std::string title):
    m_name(name),
    m_title(title)
{
    std::cout << name << ", " << title << ", is born!" << std::endl;
}

void Sorcerer::operator=(Sorcerer const& other)
{
    m_name = other.m_name;
    m_title = other.m_title;
}

Sorcerer::Sorcerer(Sorcerer const& other)
{
    *this = other;
}

Sorcerer::~Sorcerer()
{
    std::cout << m_name << ", " << m_title
              << ", is dead. Consequences will never be the same!" << std::endl;
}

std::string const& Sorcerer::getName() const
{
    return m_name;
}

std::string const& Sorcerer::getTitle() const
{
    return m_title;
}

void Sorcerer::polymorph(Victim const& v) const
{
    v.getPolymorphed();
}

Sorcerer::Sorcerer()
{
}

std::ostream& operator<<(std::ostream& out, Sorcerer const& s)
{
    out << "I am " << s.getName() << ", " << s.getTitle()
        << ", and I like ponies!" << std::endl;
    return out;
}