Vidyalelo
C# Programming · Q73

LINQ (Language

Programming · C# Programming · question 73

Q73

What will be the output of the following C# 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
Answer
C.
The cast in b = (B) a is allowed
D.
Compile time error

Answer: Option B

Solution

Answer: Option B
No explanation is given for this question Let's Discuss on Board