Question: 8 Define a class Course with a print function (that prints I am a generic course). Define a class Programming that publicly inherits the class

8 Define a class Course with a print function (that prints "I am a generic course"). Define a class Programming that publicly inherits the class Course with a print function (that prints "I am Programming"). Define a class Physics that publicly inherits the class Course with a print function (that prints "I am Physics"). Define a class Chemistry that publicly inherits the class Course with a print function (that prints "I am Chemistry"). Define a class Mathematics that publicly inherits the class Course with a print function (that prints "I am Mathematics"). Define a class New Course that publicly inherits the class Course with no member functions. Run the program with the print function being a non-virtual function Run the program with the print function being a virtual function The following driver produces the given sample of output: int main() Course Course[6); aCourse [0] = new Course: Course[1] = new Programming: aCourse [2] - new Physics; aCourse[3] = new Chemistry: aCourse[4] = new Mathematics; a Course[5] = new newCourse: I for(int i = 0; i printo: ceturn 0; aCourseli) -> printo: return 0; } Sample output: With non-virtual printo: I am a generic course. I am a generic course. I am a generic course. I am a generic course. I am a generic course. I am a generic course. With virtual printo I am a generic course. I am Programming. I am Physics. I am Chemistry. I am Mathematics. I am a generic course. 2/2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
