-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAnimal.cpp
More file actions
42 lines (34 loc) · 796 Bytes
/
Copy pathAnimal.cpp
File metadata and controls
42 lines (34 loc) · 796 Bytes
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
#include "Animal.hpp"
Animal::Animal () :
m_type ("Animal")
{
std::cout << "Animal default constructor" << std::endl;
}
Animal::Animal (const Animal &other)
{
std::cout << "Animal copy constructor" << std::endl;
m_type = other.m_type;
}
Animal::Animal (const std::string &type)
{
std::cout << "Animal string constructor" << std::endl;
m_type = type;
}
Animal::~Animal ()
{
std::cout << "Animal destructor" << std::endl;
}
Animal &Animal::operator = (const Animal &other)
{
std::cout << "Animal assignment operator" << std::endl;
m_type = other.m_type;
return *this;
}
std::string Animal::getType () const
{
return m_type;
}
void Animal::makeSound () const
{
std::cout << "HAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" << std::endl;
}