-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCat.cpp
More file actions
43 lines (37 loc) · 675 Bytes
/
Cat.cpp
File metadata and controls
43 lines (37 loc) · 675 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
43
#include "Cat.hpp"
#include "print.hpp"
Cat::Cat () : Animal ()
{
print ("Cat default constructor called");
this->_type = "Cat";
this->brain = new Brain ();
}
Cat::Cat (const Cat &other) : Animal (other)
{
print ("Cat copy constructor called");
this->brain = new Brain ();
*(this->brain) = *(other.brain);
}
Cat &
Cat::operator= (const Cat &other)
{
print ("Cat assigment operator called");
if (this != &other)
*(this->brain) = *(other.brain);
return *this;
}
Cat::~Cat ()
{
print ("Cat destructor called");
delete this->brain;
}
void
Cat::makeSound () const
{
print ("Cat sound");
}
Brain *
Cat::getBrain () const
{
return this->brain;
}