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
}

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

Is hashset ordered c#?

479


Why do you call it a process? What’s different between process and application in .net, not common computer usage, terminology?

512


How main method is called in c#?

489


What is the difference between == and object.equals?

485


Is an array an object c#?

510






Is it possible to force garbage collector to run?

466


What is a string in c#?

464


Explain about Destructor method?

524


What is difference between Trace and Debug

527


What is short in c#?

500


How do namespaces work?

498


Is c# a keyword?

471


What is yield in c#?

476


Can partial class be inherited?

477


What is int tryparse in c#?

499