This module explores subtype polymorphism, abstract classes, and interfaces in C++. You will build an inheritance tree of animals and magical materia systems to practice virtual functions, deep copies, and multiple inheritance concepts.
For each exercise, navigate to its folder, compile, and run:
๐ ex00
cd ex00
make
./ex00
๐ ex01
cd ex01
make
./ex01
๐ ex02
cd ex02
make
./ex02
ex00 โ Polymorphism: Create an Animal base class, with derived Dog and Cat classes. Demonstrate virtual functions and subtype polymorphism. Include a WrongAnimal / WrongCat example to show the effect without virtual functions.
ex01 โ I donโt want to set the world on fire: Add a Brain class to Dog and Cat for deep copy tests. Manage dynamic memory carefully to avoid leaks.
ex02 โ Abstract class: Make Animal an abstract base class to prevent direct instantiation. Keep polymorphic behavior intact.
If you have any questions or suggestions, feel free to connect: ๐ LinkedIn: Valentina Nguyen ๐โโ๏ธ
This project was developed and tested on Linux (Ubuntu).