Initializating animal when copying

This commit is contained in:
2025-11-21 11:39:22 +01:00
parent 9735e67e32
commit 45fd66c71c
4 changed files with 9 additions and 9 deletions

View File

@@ -23,7 +23,7 @@ Cat::~Cat()
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;
*this = other;