This is the fifth project featuring C++ at the 42 school.
The purpose of this project is to learn the principles of inheritance using abstract classes and interfaces in C++.
In the first exercise, the very basic example of a Dog
and a Cat
class, that inherit from an Animal
class,
is given. One can see the importance of the virtual
keyword, as the example of the WrongAnimal
and WrangCat
shows. There, the method being overwritten is not marked virtual
in the super class.
In the second exercise, the example of the first exercise is extended by an allocated Brain
in the two subclasses.
It also teaches the principle of deeply copying an instance.
In the third exercise, the Animal
class is made abstract.
The last exercise is completely different: a little game is implemented. It showcases the use of interfaces and abstract classes, once the exercise is completed correctly, the game characters can use any other materias that might be added.
© Copyright 2022 mhahnFr