Files
cpp04/ex01/WrongAnimal/WrongAnimal.cpp

47 lines
1.6 KiB
C++

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* WrongAnimal.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/11/21 12:16:12 by aortigos #+# #+# */
/* Updated: 2025/11/21 12:16:13 by aortigos ### ########.fr */
/* */
/* ************************************************************************** */
#include "WrongAnimal.hpp"
WrongAnimal::WrongAnimal() : type("WrongAnimal")
{
std::cout << "Animal has been created" << std::endl;
}
WrongAnimal::~WrongAnimal()
{
std::cout << "Animal has been destroyed" << std::endl;
}
WrongAnimal::WrongAnimal(const WrongAnimal &other)
{
std::cout << "WrongAnimal copied" << std::endl;
*this = other;
}
WrongAnimal& WrongAnimal::operator=(const WrongAnimal &other)
{
std::cout << "WrongAnimal copy assignment called" << std::endl;
if (this != &other)
this->type = other.type;
return (*this);
}
void WrongAnimal::makeSound() const
{
std::cout << "WrongAnimal weird sounds..." << std::endl;
}
std::string WrongAnimal::getType() const
{
return (this->type);
}