CPP04 dives into advanced C++ concepts such as subtype polymorphism, abstract classes, and interfaces. The exercises are designed to provide practical experience in using these object-oriented programming techniques in compliance with the C++98 standard.
This module consists of a series of exercises that build on each other, illustrating different aspects of C++ inheritance and polymorphism:
- Directory:
ex00/
- Files to submit:
Makefile
main.cpp
- Various class implementations (
*.cpp
,*.h
,*.hpp
)
Introduces basic polymorphism through the implementation of Animal
, Dog
, and Cat
classes, with animals exhibiting behavior (making sounds) specific to their types.
- Directory:
ex01/
- Files to submit:
- All files from Exercise 00 plus
- Extended classes (
*.cpp
,*.h
,*.hpp
)
Expands upon the base classes by introducing a Brain
class, exploring deep copying and dynamic memory management.
- Directory:
ex02/
- Files to submit:
- All files from Exercise 01 plus
- Modifications to make
Animal
an abstract class
Transforms the Animal
class into a true abstract class to prevent instantiation and ensures that subclasses provide specific implementations for virtual functions.
- Directory:
ex03/
- Files to submit:
Makefile
main.cpp
- Comprehensive implementations (
*.cpp
,*.h
,*.hpp
)
Implementation of purely abstract classes known as interfaces in C++, using them to enforce class structures and behaviors in derived classes.
Navigate to the specific exercise directory and use the make
command to compile the projects. Each executable can be run directly to demonstrate the functionalities implemented.