-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDog.cpp
More file actions
47 lines (41 loc) · 1.38 KB
/
Dog.cpp
File metadata and controls
47 lines (41 loc) · 1.38 KB
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Dog.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: zelhajou <zelhajou@student.1337.ma> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/06/15 21:11:19 by zelhajou #+# #+# */
/* Updated: 2024/06/16 00:38:49 by zelhajou ### ########.fr */
/* */
/* ************************************************************************** */
#include "Dog.hpp"
Dog::Dog()
{
brain = new Brain();
type = "Dog";
std::cout << "Dog created.\n";
}
Dog::Dog(const Dog& other) : AAnimal(other)
{
brain = new Brain(*other.brain);
std::cout << "Dog copied.\n";
}
Dog& Dog::operator=(const Dog& other)
{
if (this == &other)
return (*this);
AAnimal::operator=(other);
delete brain;
brain = new Brain(*other.brain);
return (*this);
}
Dog::~Dog()
{
delete brain;
std::cout << "Dog destroyed.\n";
}
void Dog::makeSound() const
{
std::cout << "Dog sound.\n";
}