Vidyalelo
C# Programming · Q234

Classes and Objects in C Sharp

Programming · C# Programming · question 234

Q234

The following C# code is run on single level of inheritance. What will be the Correct statement in the following C# code? class sample int i = 10; int j = 20; public void display() Console.WriteLine("base method "); class sample1 : sample public int s = 30; class Program static void Main(string[] args) sample1 obj = new sample1(); Console.WriteLine("0, 1, 2", obj.i, obj.j, obj.s); obj.display(); Console.ReadLine();

A.
10, 20, 30
base method
B.
10, 20, 0
C.
compile time error
Answer
D.
base method

Answer: Option C

Solution

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