1.Create a new class StaffST which has Staff and Student as base classes. StaffSt has an additional attribute (int) credithours. 2. Create the virtual string function whatami() for the Person class. The function returns the type of class - Person, Faculty, Staff, etc. Note that you must create a separate function for each derived class. 3. Write a string function classify which accepts a Person pointer variable as an argument and returns the output from whatami(). 4. Write a test main program that creates a vector of pointers to Person. Creat a Person, Student, Employee, Faculty, Staff and StaffST object and add pointers to these objects to your vector. Now use the function classify to output the type of each object from the vector pointers. |
|
|
|
|
|
|
|
|
maintest.cpp: In function 'int main()': maintest.cpp:36: error: 'class Person' has no member named 'getOffice' maintest.cpp:37: error: 'class Person' has no member named 'getSalary' maintest.cpp:38: error: 'class Person' has no member named 'getDateHired' maintest.cpp:42: error: 'class Person' has no member named 'getRank' maintest.cpp:43: error: 'class Person' has no member named 'getStatus' maintest.cpp:47: error: 'class Person' has no member named 'getPosition' maintest.cpp:51: error: 'class Person' has no member named 'getCreditHours' |
Undefined symbols for architecture x86_64: "Person::getPosition()", referenced from: vtable for Facultyin faculty.o construction vtable for Employee-in-Facultyin faculty.o vtable for Employeein employee.o vtable for Studentin student.o vtable for Personin person.o construction vtable for Employee-in-Staffin staff.o construction vtable for Student-in-Staffstin staffst.o ... "Person::getDateHired()", referenced from: vtable for Studentin student.o vtable for Personin person.o construction vtable for Student-in-Staffstin staffst.o "Person::getCreditHours()", referenced from: vtable for Facultyin faculty.o construction vtable for Employee-in-Facultyin faculty.o vtable for Employeein employee.o vtable for Studentin student.o vtable for Personin person.o vtable for Staffin staff.o construction vtable for Employee-in-Staffin staff.o ... "Person::getOffice()", referenced from: vtable for Studentin student.o vtable for Personin person.o construction vtable for Student-in-Staffstin staffst.o "Person::getSalary()", referenced from: vtable for Studentin student.o vtable for Personin person.o construction vtable for Student-in-Staffstin staffst.o "Person::getStatus()", referenced from: construction vtable for Employee-in-Facultyin faculty.o vtable for Employeein employee.o vtable for Studentin student.o vtable for Personin person.o vtable for Staffin staff.o construction vtable for Employee-in-Staffin staff.o vtable for Staffstin staffst.o ... ld: symbol(s) not found for architecture x86_64 collect2: ld returned 1 exit status |