1
0
This repository has been archived on 2025-01-26. You can view files and clone it, but cannot push or open issues or pull requests.
2024-12-06 16:06:57 +01:00

49 lines
1.6 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Dog.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/12/01 20:05:21 by adjoly #+# #+# */
/* Updated: 2024/12/06 15:53:35 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
#include "Dog.hpp"
Dog::Dog(void) : Animal("Dog"){
_brain = new Brain();
log("", "Dog", "", "construtor called");
}
Dog::~Dog(void) {
delete _brain;
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");
}
void Dog::setIdea(std::string idea, uint i) {
_brain->_ideas[i] = idea;
}
std::string Dog::getIdea(uint i) {
return (_brain->_ideas[i]);
}