Identify the output of the code given below:
using System;
class Demo1 {
public void X() {
Console.WriteLine("2");
}
}
class Demo2: Demo1 {
public new void X() {
Console.WriteLine("4");
}
}
class Test {
static void Main(string[] args) {
Demo1 s = new Demo1();
s.X();
Demo1 a = new Demo2();
a.X();
}
}
Reveal answer
Fill a bubble to check yourself