Fixed headers and copy constructor
This commit is contained in:
@@ -28,8 +28,7 @@ Cat::~Cat()
|
||||
Cat::Cat(const Cat &other) : Animal(other)
|
||||
{
|
||||
std::cout << "Cat copied" << std::endl;
|
||||
this->brain = NULL;
|
||||
*this = other;
|
||||
this->brain = new Brain(*other.brain);
|
||||
}
|
||||
|
||||
Cat& Cat::operator=(const Cat &other)
|
||||
|
||||
@@ -28,8 +28,7 @@ Dog::~Dog()
|
||||
Dog::Dog(const Dog &other) : Animal(other)
|
||||
{
|
||||
std::cout << "Dog copied" << std::endl;
|
||||
this->brain = NULL;
|
||||
*this = other;
|
||||
this->brain = new Brain(*other.brain);
|
||||
}
|
||||
|
||||
Dog& Dog::operator=(const Dog &other)
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* Animal.cpp :+: :+: :+: */
|
||||
/* WrongAnimal.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 */
|
||||
/* Created: 2025/11/21 12:16:12 by aortigos #+# #+# */
|
||||
/* Updated: 2025/11/21 12:16:13 by aortigos ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* Animal.hpp :+: :+: :+: */
|
||||
/* WrongAnimal.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 */
|
||||
/* Created: 2025/11/21 12:16:15 by aortigos #+# #+# */
|
||||
/* Updated: 2025/11/21 12:16:16 by aortigos ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* Animal.cpp :+: :+: :+: */
|
||||
/* WrongCat.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 */
|
||||
/* Created: 2025/11/21 12:16:01 by aortigos #+# #+# */
|
||||
/* Updated: 2025/11/21 12:16:02 by aortigos ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* Animal.hpp :+: :+: :+: */
|
||||
/* WrongCat.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 */
|
||||
/* Created: 2025/11/21 12:16:05 by aortigos #+# #+# */
|
||||
/* Updated: 2025/11/21 12:16:06 by aortigos ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user