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 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

}




Answers were Sorted based on User's Feedback



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

Answer / vibz

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

Is This Answer Correct ?    7 Yes 2 No

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

Answer / kanan

Vibz answer is correct at some level. but i am thinking
different way.

Call to class B's SomeMethodA
Call to class A's SomeMoreMethodA
Call to class C's SomeMethodA <-- our answers differ here
Call to class C's SomeMoreMethodA

Is This Answer Correct ?    2 Yes 2 No

Post New Answer




More C Sharp Interview Questions

can we assign null value to value type in c#?

12 Answers   Wipro, Idea, Microsoft,


what is the use of master pages. how to use it

2 Answers  


how to store the value in textbox using delegates if we have two user control. the value will be called from one user control to another user control. Loading and unloading will be done through delegates.

1 Answers  


if i used stored procedure for retrieving the data from sql server.in front end i had used data reader.when 100 records are there in table.when it has displayed ten records in frontend database has been collapsed.then where should our data available...

2 Answers   CybAge, Wipro,


What are the collection classes ?

2 Answers   Digital GlobalSoft,






How do you secure a webservice?

1 Answers   TCS,


int i,string s, String s1 Which is valuetype which is refrence type.

6 Answers   Synechron, Sytel,


What?s different about switch statements in C#?

2 Answers  


can we create an empty interface with no definitions? If so, how it should be called in the class?

3 Answers   IBM,


How can we give strong name to assembly? What is satellite assembly?

2 Answers   SMNetserv,


Using system; class main { public static void Main() { int a = 1; for (int i = 0; i < 10; i++) { int j = a * 5; Console.WriteLine(a + "*5=" + j); a++; } Console.ReadLine(); } }

1 Answers  


What are the two keywords used to pass a variable by reference in c#?

2 Answers   IBM,






Categories