Lab 4

2020_S19/wk4/lab4.cpp

The purpose of this lab is to practice inheritance and invoking base constructors with arguments. For this lab you will define a base class and three derived classes that will inherit all members with public inheritance. For each class definition, you will write a default constructor and constructor with argument(s). For each derived class constructor definition, you will invoke the base's corresponding constructor. The class definitions, constructors, and member functions you will write are as follows:



Base Class - Shape

This class will contain one protected staticallly sized cstring member variable called 'identity'. Within the public section, this class will contain only a constructor that will accept a constant cstring as an argument, an inputShape and a printShape member function.



Derived Class - Rectangle

This class will inherit members of the Shape class. In addition, this class will contain two protected member variables 'length' and 'width'.



Derived Class - Triangle

This class will inherit members of the Shape class. In addition, this class will contain two protected member variables 'base' and 'height'.



Derived Class - Circle

This class will inherit members of the Shape class. In addition, this class will contain one protected member variable 'radius'.

Lab4 Main

A partial version of main has been given to you with an example derived class called 'Square'. Fill in the missing cases within the switch and instantiate a Rectangle, Triangle, and Circle object within the doWhile loop.