Brain added

This commit is contained in:
Angel Ortigosa Perez
2025-11-10 11:47:40 +01:00
parent 5ab7e97c1e
commit a6f3e7ea31
14 changed files with 526 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Animal.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/09/06 02:27:27 by aortigos #+# #+# */
/* Updated: 2025/09/06 02:28:09 by aortigos ### ########.fr */
/* */
/* ************************************************************************** */
#include "WrongCat.hpp"
WrongCat::WrongCat() : WrongAnimal()
{
std::cout << "Cat has been created" << std::endl;
this->type = "WrongCat";
}
WrongCat::~WrongCat()
{
std::cout << "Cat has been destroyed" << std::endl;
}
WrongCat::WrongCat(const WrongCat &other)
{
std::cout << "WrongCat copied" << std::endl;
*this = other;
}
WrongCat& WrongCat::operator=(const WrongCat &other)
{
std::cout << "WrongCat copy assignment called" << std::endl;
if (this != &other)
this->type = other.type;
return (*this);
}
void WrongCat::makeSound() const
{
std::cout << "WrongCat weird sounds..." << std::endl;
}
std::string WrongCat::getType() const
{
return (this->type);
}

View File

@@ -0,0 +1,32 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Animal.hpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/09/06 02:27:27 by aortigos #+# #+# */
/* Updated: 2025/09/06 02:28:09 by aortigos ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef WRONGCAT_HPP
# define WRONGCAT_HPP
# include <iostream>
# include "../WrongAnimal/WrongAnimal.hpp"
class WrongCat : public WrongAnimal
{
public:
WrongCat();
~WrongCat();
WrongCat(const WrongCat &other);
WrongCat& operator=(const WrongCat &other);
void makeSound() const;
std::string getType() const;
};
#endif