

MCQOPTIONS
Saved Bookmarks
1. |
Which casting among the following is allowed for the code given below?
class A { public :int a; } class B:public A { int b; } main() { B b=new A(); //casting 1 A a=new B(); //casting 2 } |
A. | Casting 1 |
B. | Casting 2 |
C. | Casting 1 and casting 2 |
D. | Casting 1 nor casting 2 |
Answer» C. Casting 1 and casting 2 | |