Design a University Management System that models the hierarchy of students, faculty, and staff. Implement the system using classes and demonstrate the use of inheritance, polymorphism, and memory management techniques. Instructions:
-
Create a base class Person with private attributes:
std::string name
int age
Implement public member functions for getting and setting the name and age.
-
Derive a class Student from the Person class, with additional private attributes:
std::string studentId
double gpa
Implement public member functions for getting and setting the student ID and GPA.
-
Derive a class Faculty from the Person class, with additional private attributes:
std::string facultyId
std::string department
Implement public member functions for getting and setting the faculty ID and department.
-
Derive a class Staff from the Person class, with an additional private attribute:
std::string staffId
Implement public member functions for getting and setting the staff ID.