Home / MCQ Bank / Computer
Computer Classes And Objects In C Sharp

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(); } }

Select the best option to verify your answer:
Show Correct Answer
Correct Answer: Option C • compile time error

Related Computer Questions

What is the time complexity of floyd's cycle finding algorithm? Who developed Python Programming Language? What is the result of the expression 5 / 2.0 in C? What will be the output of the following Python code? def f(): global a print(a) a = "hello" print(a) a = "world" f() print(a) What is the difference between Queue and Stack?