CPP04/ex00/src/WrongAnimal.cpp
2025-04-14 22:07:29 +02:00

47 lines
1.9 KiB
C++

/* ************************************************************************** */
/* */
/* :::::::: */
/* WrongAnimal.cpp :+: :+: */
/* +:+ */
/* By: whaffman <whaffman@student.codam.nl> +#+ */
/* +#+ */
/* Created: 2025/04/05 17:26:52 by whaffman #+# #+# */
/* Updated: 2025/04/14 21:38:18 by whaffman ######## odam.nl */
/* */
/* ************************************************************************** */
#include "WrongAnimal.hpp"
#include <iostream>
#include <string>
#include "colors.h"
WrongAnimal::WrongAnimal()
{
this->type = "WrongAnimal";
std::cout << BACKGROUND1 << BOLD << "WrongAnimal" << RESET << " default constructor called" << std::endl;
}
WrongAnimal::WrongAnimal(const WrongAnimal &other) : type(other.type)
{
std::cout << BACKGROUND1 << BOLD << "WrongAnimal" << RESET << " copy constructor called" << std::endl;
}
WrongAnimal::~WrongAnimal()
{
std::cout << BACKGROUND1 << BOLD << "WrongAnimal" << RESET << " destructor called" << std::endl;
}
WrongAnimal &WrongAnimal::operator=(const WrongAnimal &other)
{
std::cout << BACKGROUND1 << BOLD << "WrongAnimal" << RESET << " assignment operator called" << std::endl;
if (this == &other)
return *this;
type = other.type;
return *this;
}
void WrongAnimal::makeSound(void) const
{
std::cout << BACKGROUND1 << BOLD << "WrongAnimal" << RESET << " Can't Speak" << std::endl;
}
std::string WrongAnimal::getType(void) const
{
return type;
}