|
|
| | What will be the output of the following program?. class A { public virtual void print() { Console.WriteLine("A"); } } class B:A { public override void print() { Console.WriteLine("B"); } }
class C:B { public override void print() { Console.WriteLine("C"); } }
class D:C { public override void print() { Console.WriteLine("D"); } } static void Main(string[] args) { D d=new D(); A a=d; B b=d; C c=d; a.print(); b.print(); c.print(); d.print(); Console.ReadLine();Posted By :Santosh Posted Date :October 15, 2009 Points :10 Category :C# |
| |
| | | You can also find related Interview Question to
What will be the output of the following program?.
class A {
public virtual void print() {
Console.WriteLine("A");
}
}
class B:A {
public override void print() {
Console.WriteLine("B");
}
}
class C:B {
public override void print() {
Console.WriteLine("C");
}
}
class D:C {
public override void print() {
Console.WriteLine("D");
}
}
static void Main(string[] args) {
D d=new D();
A a=d;
B b=d;
C c=d;
a.print();
b.print();
c.print();
d.print();
Console.ReadLine();
below:
| |
| | Quick Links For Interview Questions Categories: | |
| Find questions, FAQ's and their answers related to .NET, C#, Vb.Net, Sql Server and many more. |
| | | Now you can find lots of .NET, C#, Vb.Net, SQL Server,Windows, ASP.Net related Questions and their Answers here at www.dotnetspark.com. Our aim is to help you pass your certification Exams (MCP, MCSD, MCAD etc.,) with flying scores and get good name in your company.
So, Start looking our Interview Question section daily and improve your .NET Skills. You can also help others by posting Interview Questions and their Answers in this section.
|
|