CS12

Lab 6


Lab Tasks

In this lab you wil be doing a simple inheritance example. Make a person class that holds information about a person. This should contain name, age, and social security number. Make functions to set the information for the person and also to print out the information. Next you should do two additional classes. One for a student and one for a professor. Both these classes should use the person class as their base class. For the student class you need to have additional fields for the number of units and gpa. For the professor class you need to have salary and number of years teaching. You should make functions to set the information for these classes and also to print these classes. The functions should reuse code so instead of making an entirely new print function make the new print function call the old one and then output any additional information specific to the class. This lab should be much like the examples we've been going over in class.