Trace the O/p for a program on inheritance and Polymorphism.

3 classes A,B,C

A with two methods

public virtual SomeMethodA

public virtual SomemoreMethodA

B:A
overide virtual SomeMethodA

C:B
new Method SomeMethodA

override SomeMoreMethodA

main method
{
b new instance of B
b.SomeMethodA
b.SomeMoreMethodA

b1 new instance of C
b1.SomeMethodA
b1.SomeMoreMethodA
}






Trace the O/p for a program on inheritance and Polymorphism. 3 classes A,B,C A with two method..

Answer / payal

call B's SomeMethodA
Call A's SomeMoreMethodA
call C's SomeMethodA
call C's SomeMoreMethodA

Is This Answer Correct ?    1 Yes 0 No

Post New Answer




More C Sharp Interview Questions

Why multiple inheritance is not possible in c#

8 Answers  


What are three test cases you should go through in unit testing?

1 Answers   Wipro,


Can we write one page in c# and other in vb in one application ?

3 Answers   Keane India Ltd,


How do you debug an ASP.NET Web application?

1 Answers  


In c# how to connect crystal report?

2 Answers  






from web.config file with connection string who to interact means who to connect in gridview. in my system shows null something error what is the problem

3 Answers   Bally Technologies,


In a stored procedure 4 select stmts there.If error comes in one select stmt will remaining normally executes?

7 Answers   Microsoft,


int i = 1; int j = 1; System.Console.WriteLine(i == j); System.Console.WriteLine(i.ToString() == j.ToString()); System.Console.WriteLine((object)i == (object)j); Give the sample code above, what is the output to the console?

5 Answers  


What is Bubble Event ?

2 Answers   HCL,


For a combobox and a listbox same datatable given as a datasource. Now problem is that whenever focus of listbox changes selected value of combobox also get change or vice versa. what to be done to avoid this. According to requirement we cannot make different datasouce.

2 Answers   Syntel,


Hoe can i connect the table into the c# application?

2 Answers  


Can you inherit multiple interfaces?

3 Answers  






Categories