Program 7

Home Windows C++ 241 C++ 242 Contact Info Contents

Program 7 - February 26

Up

Base Assignment

Develop the class hierarchy in exercise 10.15. Note that this is a very simple program as far as the calculations go, so just work on getting the inheritance structure right.

Your test program should maintain an array of Shape pointers. It should use a loop to output the type, dimensions, area and volume of each shape without checking to see exactly what the shape is. 

Add a comment in the header file that tells a programmer what to do in order to add a new shape to your class hierarchy.

Extra Credit

Modify your TicTacToe program to use a virtual base class called Player. Derive concrete classes from Player to represent the human and computer player. Modify your main program so it uses new to create the human and computer player and saves pointers to each of them in a variable of type Player *. Modify your main program so it makes all its calls through these pointers and is never aware of what kind of player it is calling.

Up

Home Windows C++ 241 C++ 242 Contact Info Contents

Copyright © 2000  Charlie Poole. All rights reserved.
Revised: July 15, 2002 - cpoole@ctc.edu