Basic Structure

C++ supports polymorphism through virtual functions. The selection of an appropriate function is done at run time, which is called late or dynamic binding. The particular function to invoke is determined at run-time based on the specific type of object. This mechanism is possible only through the use of pointers to objects.

In this lab, you have to implement the following class hierarchy.

Shape is the base class. It only provides the interfaces, which the derived classes, i.e. Rectangle and Triangle should implement. The three functions which are common to the Rectangle and Triangle class are

In the following steps, you will find all the information you need about the Shape, Rectangle and Triangle classes in order to implement the virtual functions.