This project introduces polymorphism and interfaces in C++ through an Animal
class hierarchy, where Dog
and Cat
inherit from Animal
, showcasing polymorphic behavior with the makeSound()
method. The exercises build on this by adding abstract classes, deep copying, memory management, and interfaces for managing unique attributes and behaviors.
Objectives 🚀:
- Implement a basic
Animal
class and deriveDog
andCat
classes.
Requirements:
- Define
Animal
with protected attributetype
. Dog
andCat
initializetype
as "Dog" or "Cat".- Create
makeSound()
for each class to produce specific sounds.
Objectives 🚀:
- Extend
Dog
andCat
with uniqueBrain
objects.
Requirements:
- Add a
Brain
class with 100std::string
ideas. Dog
andCat
have privateBrain*
attributes, allocated withnew
and deleted on destruction.- Ensure deep copying of
Dog
andCat
objects.
Objectives 🚀:
- Make
Animal
an abstract class.
Requirements:
- Convert
Animal
into an abstract base class, making it non-instantiable. - Derived classes like
Dog
andCat
remain functional.
Objectives 🚀:
- Implement interfaces using abstract classes.
Requirements:
- Create
AMateria
withclone()
anduse()
as pure virtual methods. - Implement
Ice
andCure
classes with specificuse
actions. - Develop
Character
andMateriaSource
classes with inventory and item management features.