/cpp04

About subtype polymorphism, abstract classes, and interfaces to enhance code flexibility and design

Primary LanguageC++

C++ Module 04

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.

πŸ› οΈ Usage

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

πŸ“ Exercise Descriptions

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.

πŸ’Ό Connect

If you have any questions or suggestions, feel free to connect: πŸ”— LinkedIn: Valentina Nguyen πŸ™‹β€β™€οΈ

πŸ–₯️ System Compatibility

This project was developed and tested on Linux (Ubuntu).