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

What are cshtml files?

0 Answers  


Can you inherit from a static class in c#?

0 Answers  


What is verbatim literal in c#?

0 Answers  


What is type safe code?

0 Answers  


Is c# 8 released?

0 Answers  






What is the difference between interface and abstract class ?

2 Answers   Basware, BITS,


If you want to write your own dot net language, what steps you will u take care?

0 Answers  


What is Implementation inheritance and interface inheritance?

0 Answers  


What is ulong in c#?

0 Answers  


Can we have 2 main methods in c#?

0 Answers  


What is the main method in c#?

0 Answers  


What is the use of private constructor in c#?

0 Answers  


Categories