cpp04/ex02/AAnimal.cpp

38 lines
712 B
C++

# include "AAnimal.hpp"
AAnimal::AAnimal (std::string type) : _type(type)
{
std::cout << "AAnimal constructor called\n";
}
AAnimal::AAnimal() : _type("Default")
{
std::cout << "AAnimal def constructor called\n";
}
AAnimal::AAnimal(const AAnimal &other) : _type(other._type)
{
std::cout << "AAnimal copy constructor called\n";
}
AAnimal &AAnimal::operator=(const AAnimal &other)
{
_type = other._type;
std::cout << "AAnimal copy assignment constructor called\n";
return (*this);
}
AAnimal::~AAnimal()
{
std::cout << "AAnimal deconstructor called\n";
}
void AAnimal::makeSound() const
{
std::cout << "AAnimal can make different sounds.\n";
}
std::string AAnimal::getType() const
{
return (_type);
}