Animal, Dog and Cat classes created and finished

This commit is contained in:
2025-11-09 21:56:00 +01:00
parent 21a7edfacb
commit d893207a3c
8 changed files with 171 additions and 6 deletions

43
ex00/Dog/Dog.cpp Normal file
View File

@@ -0,0 +1,43 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Dog.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 "Dog.hpp"
Dog::Dog() : Animal()
{
std::cout << "Dog has been created" << std::endl;
this->type = "Dog";
}
Dog::~Dog()
{
std::cout << "Dog has been destroyed" << std::endl;
}
Dog::Dog(const Dog &other)
{
std::cout << "Dog copied" << std::endl;
*this = other;
}
Dog& Dog::operator=(const Dog &other)
{
std::cout << "Dog copy assignment called" << std::endl;
if (this != &other)
this->type = other.type;
return (*this);
}
void Dog::makeSound() const
{
std::cout << "Woof!" << std::endl;
}