Exercise 3: Displaying Message Using Virtual Functions
Explore how to implement virtual functions in C++ by defining a base class Mammal and derived classes Dog and Cat. Understand how to override methods like Eat and Speak to display class-specific messages, enhancing your grasp of polymorphism and inheritance in C++.
We'll cover the following...
We'll cover the following...
Problem statement
We will first build three classes: Mammal (parent class), Dog (derived class) and Cat (derived class). The Dog and Cat class will inherit from Mammal.
In the exercise, implement these classes with the following characteristics:
...