people.cpp

URL: http://147.64.242.52/~bennett/class/cmsc2040/fall2026/notes/inherit/code/preClass/people.cpp
 
#include <iostream>
#include "PersonT.h"

using namespace std;

int main() {

    cout << "Building a person" << endl;
    PersonT person;
    person.Name("Sue");
    cout << endl;

    cout << "Building a student " << endl;
    StudentT student;
    cout << endl;

    student.Name("Fred");
    student.GPA(4.0);

    cout << "Buliding a professor" << endl;
    ProfessorT professor;
    cout << endl;

    professor.Name("Dan");
    professor.Classes(4);

    GradStudentT gradStudent;

    gradStudent.Role("Goofing Off");
    gradStudent.Name("Lisa");
   
    cout << person.Name() << " is a " << person.Role() << endl;
    cout << student.Name() << " is a " << student.Role() 
         << " with a gpa of " << student.GPA() << endl;
    cout << professor.Name() << " is a " << professor.Role() 
         << " who teaches " << professor.Classes() << " classes." << endl;
    cout << gradStudent.Name() << " is a " << gradStudent.Role() << endl;

    return 0;
}