-
Notifications
You must be signed in to change notification settings - Fork 0
/
Animal.cpp
47 lines (40 loc) · 1.39 KB
/
Animal.cpp
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Animal.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: zelhajou <zelhajou@student.1337.ma> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/06/15 20:52:45 by zelhajou #+# #+# */
/* Updated: 2024/06/15 21:39:38 by zelhajou ### ########.fr */
/* */
/* ************************************************************************** */
#include "Animal.hpp"
Animal::Animal() : type("Animal")
{
std::cout << "Animal created.\n";
}
Animal::Animal(const Animal& other) : type(other.type)
{
std::cout << "Animal copied.\n";
}
Animal& Animal::operator=(const Animal& other)
{
if (this != &other) {
type = other.type;
}
std::cout << "Animal assigned.\n";
return *this;
}
Animal::~Animal()
{
std::cout << "Animal destroyed.\n";
}
void Animal::makeSound() const
{
std::cout << "Animal sound.\n";
}
std::string Animal::getType() const
{
return type;
}