EECE 330 Homework 1 Assignment, Fall 2011

American University of Beirut · Data Structures and Algorithms · 1 page

All EECE 330 files
EECE 330 Homework 1 Assignment, Fall 2011, page 1

Stuck on a question? A tutor can walk you through it.

More EECE 330 files

Show the text of this homework
EECE 330 Assignment 1, Inheritance, virtual functions, and templates Write a pure virtual class Person which has a name (string) and an age (int). You cannot instantiate from it. Derive from it two classes: Teacher which has a salary(int) and Student which has a grade (char) and fees (double). Provide constructors with parameters and readers and writers for these two classes. Also provide a virtual function print for each. Write a main program which declares an array of pointers (size 4) to person. Write a loop to choose a Teacher or Student object (t or T for teacher, s or S for student otherwise display wrong choice), and then read the required parameters. Finally, pass the array to a template sort function to sort records in ascending order according to name.