Which Among The Following Is Correct For Following Codep Pre #787
Which among the following is correct for following code?</p> <pre><code class="language-cpp"> 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(); } </code></pre>
This multiple choice question (MCQ) is related to the book/course
gs gs111 OOP Object Oriented Programming Java.
It can also be found in
gs gs111 Inheritance & its Types - OOPs MCQ: Hierarchical Inheritance - Quiz No.1.
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(); }
Compile time error
Runtime error
Program runs and o/p is 0
Program runs and o/p is garbage value