47 lines
1.6 KiB
C++
47 lines
1.6 KiB
C++
|
/* ************************************************************************** */
|
|||
|
/* */
|
|||
|
/* ::: :::::::: */
|
|||
|
/* animal.cpp :+: :+: :+: */
|
|||
|
/* +:+ +:+ +:+ */
|
|||
|
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
|||
|
/* +#+#+#+#+#+ +#+ */
|
|||
|
/* Created: 2024/12/01 19:14:27 by adjoly #+# #+# */
|
|||
|
/* Updated: 2024/12/01 20:22:32 by adjoly ### ########.fr */
|
|||
|
/* */
|
|||
|
/* ************************************************************************** */
|
|||
|
|
|||
|
#include "animal.hpp"
|
|||
|
|
|||
|
Animal::Animal(void) {
|
|||
|
log("➕", "Animal", "", "construtor called");
|
|||
|
}
|
|||
|
|
|||
|
Animal::~Animal() {
|
|||
|
log("➖", "Animal", _type, "destructor called");
|
|||
|
}
|
|||
|
|
|||
|
Animal::Animal(std::string type) : _type(type) {
|
|||
|
log("➕", "Animal", type, "construtor called");
|
|||
|
}
|
|||
|
|
|||
|
Animal::Animal(const Animal &cpy) {
|
|||
|
log("➕", "Animal", _type, "copy construtor called");
|
|||
|
*this = cpy;
|
|||
|
}
|
|||
|
|
|||
|
Animal &Animal::operator=(const Animal &cpy) {
|
|||
|
log("🟰", "Animal", _type, "copy assignment construtor called");
|
|||
|
if (this != &cpy) {
|
|||
|
_type = cpy._type;
|
|||
|
}
|
|||
|
return (*this);
|
|||
|
}
|
|||
|
|
|||
|
void Animal::makeSound(void) const {
|
|||
|
log("🔊", "Animal", "", "making a sound MEOWMEOW");
|
|||
|
}
|
|||
|
|
|||
|
std::string Animal::getType(void) const {
|
|||
|
return (_type);
|
|||
|
}
|