CS 127: Data Structures, Fall 2000
Project 4: Shape Inheritance
Overview
This project will give you a chance to practice creating classes using
inheritance. Check out this program: project4.cpp
. This program asks a user to select a shape of interest, namely a circle,
rectangle or square. It gets the dimensions from the user, then computes
the area and perimeter and displays it to the screen. The code for the
individual classes can be found at the links below:
This program could be made much cleaner with inheritance! Create a single
class called Shape, and derive the Circle, Rectangle, and Square classes
from it using inheritance. Then project4.cpp so that it doesn't duplicate
so much code. You should submit the files Shape.h, Shape.cpp, and project4.cpp.
The Shape.h and Shape.cpp files should contain the code for the class Shape
as well as for the derived classes Circle, Rectangle, and Square.
Good luck!