update: rm -rf to restart from scratch
This commit is contained in:
parent
42e83d8e62
commit
5e999def3a
45 changed files with 813 additions and 366 deletions
|
|
@ -5,24 +5,54 @@
|
|||
/* +:+ +:+ +:+ */
|
||||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/01/30 13:32:43 by rparodi #+# #+# */
|
||||
/* Updated: 2025/02/10 12:22:32 by rparodi ### ########.fr */
|
||||
/* Created: 2025/02/18 16:22:05 by rparodi #+# #+# */
|
||||
/* Updated: 2025/02/18 20:14:10 by rparodi ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "Cat.hpp"
|
||||
#include <iostream>
|
||||
|
||||
Cat::Cat() {
|
||||
std::cout << "[Cat]\t\tCreating the class" << std::endl;
|
||||
std::cout << "[Cat]\t\tCreating Cat class" << std::endl;
|
||||
type = "Cat";
|
||||
brain = new Brain();
|
||||
}
|
||||
|
||||
Cat::Cat(Cat const & copy) {
|
||||
std::cout << "[Cat]\t\tCreating Cat class (copy)" << std::endl;
|
||||
this->type = copy.type;
|
||||
this->brain = new Brain(*copy.brain);
|
||||
}
|
||||
|
||||
Cat & Cat::operator=(Cat const & assign) {
|
||||
if (this != &assign) {
|
||||
std::cout << "[Cat]\t\tCreating Cat class (assign)" << std::endl;
|
||||
this->type = assign.type;
|
||||
for (int i = 0; i < 100; i++)
|
||||
this->brain[i] = assign.brain[i];
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
Cat* Cat::clone() const {
|
||||
std::cout << "[Cat]\t\tCopying Cat class (DeepCopy)" << std::endl;
|
||||
return new Cat(*this);
|
||||
}
|
||||
|
||||
Cat::~Cat() {
|
||||
delete brain;
|
||||
std::cout << "[Cat]\t\tDeleting the class" << std::endl;
|
||||
std::cout << "[Cat]\t\tDeleting Cat class" << std::endl;
|
||||
}
|
||||
|
||||
void Cat::setIdea(int const index, std::string const idea) const {
|
||||
brain->setIdea(index, idea);
|
||||
}
|
||||
|
||||
std::string Cat::getIdea(int const index) const {
|
||||
return brain->getIdea(index);
|
||||
}
|
||||
|
||||
void Cat::makeSound() const {
|
||||
std::cout << "🐱 | Meow Meow" << std::endl;
|
||||
std::cout << "[Cat]\t\t🐱 | Meow meow" << std::endl;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue