MCQOPTIONS
Saved Bookmarks
| 1. |
The following set of code is run on single level of inheritance. Find correct statement about the 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 |
| B. | 10, 20, 0 |
| C. | Compile time error |
| D. | Base method |
| Answer» D. Base method | |