

MCQOPTIONS
Saved Bookmarks
1. |
Which class/set of classes can illustrate polymorphism in the following code: abstract class student { public : int marks; calc_grade(); } class topper:public student { public : calc_grade() { return 10; } }; class average:public student { public : calc_grade() { return 20; } }; class failed{ int marks; }; |
A. | Only class student can show polymorphism |
B. | Only class student and topper together can show polymorphism |
C. | All class student, topper and average together can show polymorphism |
D. | Class failed should also inherit class student for this code to work for polymorphism |
Answer» D. Class failed should also inherit class student for this code to work for polymorphism | |