Initializating animal when copying
This commit is contained in:
@@ -23,7 +23,7 @@ Cat::~Cat()
|
|||||||
std::cout << "Cat has been destroyed" << std::endl;
|
std::cout << "Cat has been destroyed" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
Cat::Cat(const Cat &other)
|
Cat::Cat(const Cat &other) : Animal(other)
|
||||||
{
|
{
|
||||||
std::cout << "Cat copied" << std::endl;
|
std::cout << "Cat copied" << std::endl;
|
||||||
*this = other;
|
*this = other;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ Dog::~Dog()
|
|||||||
std::cout << "Dog has been destroyed" << std::endl;
|
std::cout << "Dog has been destroyed" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
Dog::Dog(const Dog &other)
|
Dog::Dog(const Dog &other) : Animal(other)
|
||||||
{
|
{
|
||||||
std::cout << "Dog copied" << std::endl;
|
std::cout << "Dog copied" << std::endl;
|
||||||
*this = other;
|
*this = other;
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* ::: :::::::: */
|
/* ::: :::::::: */
|
||||||
/* Animal.cpp :+: :+: :+: */
|
/* WrongCat.cpp :+: :+: :+: */
|
||||||
/* +:+ +:+ +:+ */
|
/* +:+ +:+ +:+ */
|
||||||
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
|
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/09/06 02:27:27 by aortigos #+# #+# */
|
/* Created: 2025/11/21 11:38:27 by aortigos #+# #+# */
|
||||||
/* Updated: 2025/09/06 02:28:09 by aortigos ### ########.fr */
|
/* Updated: 2025/11/21 11:38:49 by aortigos ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@ WrongCat::~WrongCat()
|
|||||||
std::cout << "Cat has been destroyed" << std::endl;
|
std::cout << "Cat has been destroyed" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
WrongCat::WrongCat(const WrongCat &other)
|
WrongCat::WrongCat(const WrongCat &other) : WrongAnimal(other)
|
||||||
{
|
{
|
||||||
std::cout << "WrongCat copied" << std::endl;
|
std::cout << "WrongCat copied" << std::endl;
|
||||||
*this = other;
|
*this = other;
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* ::: :::::::: */
|
/* ::: :::::::: */
|
||||||
/* Animal.hpp :+: :+: :+: */
|
/* WrongCat.hpp :+: :+: :+: */
|
||||||
/* +:+ +:+ +:+ */
|
/* +:+ +:+ +:+ */
|
||||||
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
|
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/09/06 02:27:27 by aortigos #+# #+# */
|
/* Created: 2025/11/21 11:38:32 by aortigos #+# #+# */
|
||||||
/* Updated: 2025/09/06 02:28:09 by aortigos ### ########.fr */
|
/* Updated: 2025/11/21 11:38:34 by aortigos ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user