2024-12-01 20:24:38 +01:00
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
/* */
|
|
|
|
|
/* ::: :::::::: */
|
2024-12-06 16:06:57 +01:00
|
|
|
|
/* Dog.cpp :+: :+: :+: */
|
2024-12-01 20:24:38 +01:00
|
|
|
|
/* +:+ +:+ +:+ */
|
|
|
|
|
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
|
|
|
|
/* +#+#+#+#+#+ +#+ */
|
|
|
|
|
/* Created: 2024/12/01 20:05:21 by adjoly #+# #+# */
|
2024-12-06 16:06:57 +01:00
|
|
|
|
/* Updated: 2024/12/06 15:53:35 by adjoly ### ########.fr */
|
2024-12-01 20:24:38 +01:00
|
|
|
|
/* */
|
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
2024-12-06 16:06:57 +01:00
|
|
|
|
#include "Dog.hpp"
|
2024-12-01 20:24:38 +01:00
|
|
|
|
|
|
|
|
|
Dog::Dog(void) : Animal("Dog"){
|
2024-12-06 16:06:57 +01:00
|
|
|
|
_brain = new Brain();
|
2024-12-01 20:24:38 +01:00
|
|
|
|
log("➕", "Dog", "", "construtor called");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Dog::~Dog(void) {
|
2024-12-06 16:06:57 +01:00
|
|
|
|
delete _brain;
|
2024-12-01 20:24:38 +01:00
|
|
|
|
log("➖", "Dog", "", "destructor called");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Dog::Dog(const Dog &cpy) : Animal("Dog"){
|
|
|
|
|
log("➕", "Dog", _type, "copy construtor called");
|
|
|
|
|
*this = cpy;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Dog &Dog::operator=(const Dog &cpy) {
|
|
|
|
|
log("🟰", "Dog", "", "copy assignment construtor called");
|
|
|
|
|
if (this != &cpy) {
|
|
|
|
|
this->_type = cpy._type;
|
|
|
|
|
}
|
|
|
|
|
return (*this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Dog::makeSound(void) const {
|
|
|
|
|
log("🔊", "Dog", "", "woof");
|
|
|
|
|
}
|
2024-12-06 16:06:57 +01:00
|
|
|
|
|
|
|
|
|
void Dog::setIdea(std::string idea, uint i) {
|
|
|
|
|
_brain->_ideas[i] = idea;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::string Dog::getIdea(uint i) {
|
|
|
|
|
return (_brain->_ideas[i]);
|
|
|
|
|
}
|