aboutsummaryrefslogtreecommitdiff
path: root/cpp04/ex00/Sorcerer.cpp
blob: 21c313b505e755867db0495be2626be5732ce9d4 (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
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   Sorcerer.cpp                                       :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: charles <charles.cabergs@gmail.com>        +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/04/13 20:29:19 by charles           #+#    #+#             */
/*   Updated: 2020/11/17 08:45:02 by cacharle         ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#include "Sorcerer.hpp"

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

Sorcerer& Sorcerer::operator=(Sorcerer const& other)
{
    m_name  = other.m_name;
    m_title = other.m_title;
    return *this;
}

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;
}