Q:

Which among the following is correct for following code ?

0

Which among the following is correct for following code ?

abstract class A
{
 public Int a;
 public void disp();
};
class B:public A
{
 public: void dis()
 { 
  court<<a; 
 }
};
class C:private A
{
 public void incr()
 { 
  a++; 
 }
}
void main()
{
 B b.disp();
}

  1. Compile time error
  2. Runtime error
  3. Program runs and o/p is 0
  4. Program runs and o/p is garbage value

All Answers

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

(a).Compile time error

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

total answers (1)

OBJECT ORIENTED PROGRAMMING INHERITANCE AND ITS TYPES MCQ

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
How many classes can be derived from the base clas... >>
<< Which class uses hierarchical inheritance in follo...