-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAnimal.cpp
More file actions
55 lines (46 loc) · 1.68 KB
/
Copy pathAnimal.cpp
File metadata and controls
55 lines (46 loc) · 1.68 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
48
49
50
51
52
53
54
55
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Animal.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: fde-alme <fde-alme@student.42porto.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/12/09 21:46:39 by fde-alme #+# #+# */
/* Updated: 2025/12/09 23:08:45 by fde-alme ### ########.fr */
/* */
/* ************************************************************************** */
#include "Animal.hpp"
#include <iostream>
Animal::Animal(void) : _type("Animal")
{
std::cout << "Animal default constructor called." << std::endl;
}
Animal::Animal(std::string const &type) : _type(type)
{
std::cout << "Animal parameterized constructor called." << std::endl;
}
Animal::Animal(Animal const &other) : _type(other._type)
{
std::cout << "Animal copy constructor called." << std::endl;
}
Animal::~Animal(void)
{
std::cout << "Animal destructor called." << std::endl;
}
Animal &Animal::operator=(Animal const &other)
{
if (this != &other)
{
_type = other._type;
}
std::cout << "Animal copy assignment operator called." << std::endl;
return (*this);
}
void Animal::makeSound() const
{
std::cout << "** no sound **" << std::endl;
}
std::string const &Animal::getType(void) const
{
return (_type);
}