Vidyalelo
C# Programming · Q212

Classes and Objects in C Sharp

Programming · C# Programming · question 212

Q212

What will be the output of the following C# code? class a public void fun() Console.WriteLine("base method"); class b: a public new void fun() Console.WriteLine(" derived method "); class Program static void Main(string[] args) b k = new b(); k.fun(); Console.ReadLine();

A.
Base method
B.
Derived method
Answer
C.
Code runs successfully prints nothing
D.
Compile time error

Answer: Option B

Solution

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