Files
cpp04/ex01/Animal/Animal.cpp
Angel Ortigosa Perez a6f3e7ea31 Brain added
2025-11-10 11:47:40 +01:00

47 lines
1.5 KiB
C++

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* 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 "Animal.hpp"
Animal::Animal() : type("Animal")
{
std::cout << "Animal has been created" << std::endl;
}
Animal::~Animal()
{
std::cout << "Animal has been destroyed" << std::endl;
}
Animal::Animal(const Animal &other)
{
std::cout << "Animal copied" << std::endl;
*this = other;
}
Animal& Animal::operator=(const Animal &other)
{
std::cout << "Animal copy assignment called" << std::endl;
if (this != &other)
this->type = other.type;
return (*this);
}
void Animal::makeSound() const
{
std::cout << "Animal weird sounds..." << std::endl;
}
std::string Animal::getType() const
{
return (this->type);
}