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