Brain added
This commit is contained in:
47
ex01/WrongAnimal/WrongAnimal.cpp
Normal file
47
ex01/WrongAnimal/WrongAnimal.cpp
Normal file
@@ -0,0 +1,47 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* Animal.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 "WrongAnimal.hpp"
|
||||
|
||||
WrongAnimal::WrongAnimal() : type("WrongAnimal")
|
||||
{
|
||||
std::cout << "Animal has been created" << std::endl;
|
||||
}
|
||||
|
||||
WrongAnimal::~WrongAnimal()
|
||||
{
|
||||
std::cout << "Animal has been destroyed" << std::endl;
|
||||
}
|
||||
|
||||
WrongAnimal::WrongAnimal(const WrongAnimal &other)
|
||||
{
|
||||
std::cout << "WrongAnimal copied" << std::endl;
|
||||
*this = other;
|
||||
}
|
||||
|
||||
WrongAnimal& WrongAnimal::operator=(const WrongAnimal &other)
|
||||
{
|
||||
std::cout << "WrongAnimal copy assignment called" << std::endl;
|
||||
if (this != &other)
|
||||
this->type = other.type;
|
||||
return (*this);
|
||||
}
|
||||
|
||||
void WrongAnimal::makeSound() const
|
||||
{
|
||||
std::cout << "WrongAnimal weird sounds..." << std::endl;
|
||||
}
|
||||
|
||||
std::string WrongAnimal::getType() const
|
||||
{
|
||||
return (this->type);
|
||||
}
|
||||
33
ex01/WrongAnimal/WrongAnimal.hpp
Normal file
33
ex01/WrongAnimal/WrongAnimal.hpp
Normal file
@@ -0,0 +1,33 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* Animal.hpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* 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 */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef WRONGANIMAL_HPP
|
||||
|
||||
# define WRONGANIMAL_HPP
|
||||
|
||||
# include <iostream>
|
||||
|
||||
class WrongAnimal
|
||||
{
|
||||
protected:
|
||||
std::string type;
|
||||
public:
|
||||
WrongAnimal();
|
||||
~WrongAnimal();
|
||||
WrongAnimal(const WrongAnimal &other);
|
||||
WrongAnimal& operator=(const WrongAnimal &other);
|
||||
|
||||
void makeSound() const;
|
||||
std::string getType() const;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user