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