Q:

Which casting among the following is allowed for the code given below?

0

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
}

  1. Casting 1
  2. Casting 2
  3. casting 1 and casting 2
  4. casting 1 nor casting 2

All Answers

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

 (b).Casting 2

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