Q:

Which class/set of classes can illustrate polymorphism in the following code:

0

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; };

  1. Only class student can show polymorphism
  2. Only class student and topper together can show polymorphism
  3. All class student, topper and average together can show polymorphism
  4. Class failed should also inherit class student for this code to work for polymorphism

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

 (c).All class student, topper and average together can show polymorphism

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now