Question
Here is the code from the previous three steps: #include using namespace std; class Student { private: //class variables int ID; string firstName,lastName; public: Student(int
Here is the code from the previous three steps:
#include
class Student { private: //class variables int ID; string firstName,lastName; public: Student(int ID,string firstName,string lastName) //constructor { this->ID=ID; this->firstName=firstName; this->lastName=lastName; } int getID() //getter method { return ID; } virtual string getType() = 0; //pure virtual function virtual void printInfo() //virtual function to print basic details of a student { cout supervisor=supervisor; this->thesis=thesis; } void printInfo() //method to print the additional details of a student { Student::printInfo(); cout
int main() //main method to test the functions { ResearchStudent r(101,"Debjit","Ganguli","Debayan Ganguly","AI"); r.printInfo(); TaughtStudent t(102,"Indrajit","Ghosh"); t.registerFor("AI"); t.registerFor("ML"); t.printInfo(); return 0; }
Q6. Write a function (not a method of a class) void student Tester) which contains code to test the classes you have developed in the previous three questions. When this function is called it should: Create two research students .Create two taught students, and register them for three modules each .Make an array of pointers to Student and point the elements of the array at your four student objects. Run a for loop which calls each student's printinto0 method, using the array of pointersStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started