CPP04/ex01/src/Dog.cpp
2025-04-07 17:47:36 +02:00

44 lines
1.5 KiB
C++

/* ************************************************************************** */
/* */
/* :::::::: */
/* Dog.cpp :+: :+: */
/* +:+ */
/* By: whaffman <whaffman@student.codam.nl> +#+ */
/* +#+ */
/* Created: 2025/04/05 17:06:12 by whaffman #+# #+# */
/* Updated: 2025/04/06 12:26:31 by whaffman ######## odam.nl */
/* */
/* ************************************************************************** */
#include "Dog.hpp"
#include <iostream>
#include <string>
Dog::Dog()
{
this->type = "Dog";
std::cout << "Dog default constructor called" << std::endl;
}
Dog::Dog(const Dog &dog) : Animal(dog)
{
this->type = dog.type;
std::cout << "Dog copy constructor called" << std::endl;
}
Dog::~Dog()
{
std::cout << "Dog destructor called" << std::endl;
}
Dog &Dog::operator=(const Dog &dog)
{
std::cout << "Dog assignment operator called" << std::endl;
if (this == &dog)
return *this;
type = dog.type;
return *this;
}
void Dog::makeSound(void) const
{
std::cout << "Woof" << std::endl;
}