49 lines
1.6 KiB
C++
49 lines
1.6 KiB
C++
/* ************************************************************************** */
|
||
/* */
|
||
/* ::: :::::::: */
|
||
/* Dog.cpp :+: :+: :+: */
|
||
/* +:+ +:+ +:+ */
|
||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||
/* +#+#+#+#+#+ +#+ */
|
||
/* Created: 2024/12/01 20:05:21 by adjoly #+# #+# */
|
||
/* Updated: 2024/12/06 16:09:36 by adjoly ### ########.fr */
|
||
/* */
|
||
/* ************************************************************************** */
|
||
|
||
#include "Dog.hpp"
|
||
|
||
Dog::Dog(void) : AAnimal("Dog"){
|
||
_brain = new Brain();
|
||
log("➕", "Dog", "", "construtor called");
|
||
}
|
||
|
||
Dog::~Dog(void) {
|
||
delete _brain;
|
||
log("➖", "Dog", "", "destructor called");
|
||
}
|
||
|
||
Dog::Dog(const Dog &cpy) : AAnimal("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");
|
||
}
|
||
|
||
void Dog::setIdea(std::string idea, uint i) {
|
||
_brain->_ideas[i] = idea;
|
||
}
|
||
|
||
std::string Dog::getIdea(uint i) {
|
||
return (_brain->_ideas[i]);
|
||
}
|