ExamVeda
Login
Home
LINQ (Language Integrated Query) in C Sharp
?

What will be the output of the following C# code snippet?
class B { }
class A : B { }
class Program
{
    static void Main(string[] args)
    {
        A a = new A();
        B b = new B();
        if (a is A) 
        Console.WriteLine("a is an A");
        if (b is A)
        Console.WriteLine("b is an A because it is derived from A");
        if (a is B)
        Console.WriteLine("This won’t display -- a not derived from B");
        Console.ReadLine();
    }
}

Answer & Solution
Correct Answer: Option A
Let's discuss the solution. Join the discussion
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.