1.

What will be the output of the given code snippet?
 class A {} class B : A {} class CheckCast { static void Main() { A a = new A(); B b = new B(); b = a as B; b = null; if(b==null) Console.WriteLine("The cast in b = (B) a is NOT allowed."); else Console.WriteLine("The cast in b = (B) a is allowed"); } } 

A. Run time error
B. The cast in b = (B) a is NOT allowed
C. The cast in b = (B) a is allowed
D. Compile time error
Answer» C. The cast in b = (B) a is allowed


Discussion

No Comment Found