Quiz
Let's test your understanding of the concept of polymorphism with the help of a short quiz.
1
What is the output of the following piece of code?
class Base {
public Base() {}
public void Print() {
Console.WriteLine("Base");
}
}
class Derived : Base {
public Derived() {}
public new void Print() {
Console.WriteLine("Derived");
}
}
class Demo {
public static void Main(string[] args) {
Base obj = new Derived();
obj.Print();
}
}
A)
Base
B)
Base Derived
C)
Derived
D)
None of the above
Question 1 of 40 attempted
Get hands-on with 1400+ tech skills courses.