CPP04/ex00/src/Dog.cpp
2025-04-14 18:13:35 +02:00

47 lines
1.6 KiB
C++

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