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

What are the advantages of using delegates in c#?

478


List down the fundamental oop concepts?

510


Why do you need boxing in c#?

496


Why c# is type safe?

528


What are the value types in c#?

518






How jit (just in time) works?

519


When should we use sealed class in c#?

502


What are the string functions in c#?

530


Can a constructor be private in c#?

488


Why do we use namespace in c#?

534


What do you mean by directing?

497


Can partial class be inherited?

512


Is namespace necessary in c#?

498


What is the main method?

493


How can I access the registry from c# code?

524