1.What is the major advantage of polymorphism? Please don't
simply say binding. Specify any other reason.
Answer Posted / ashutosh
the main reason to use polymorphism is generalization, as
you can see in case of overloading. say if i have add
function which just add two intergers. and i have one more
similar kind of functionality then in that case i will do
the overloading as only my internal implemantation will
vary.
second thing is consistency in code.
and in case of overriding main advantage is you can invoke
child class function dynamically(means by creating the
object of base class as normally we do).
suppose one of my function expects my base class type
object and i want functionality of overrided function then
in that case i can simply write (parent obj = new child();)
| Is This Answer Correct ? | 8 Yes | 1 No |
Post New Answer View All Answers
How many types of transactions are there in com + .net ?
Please explain what is immutability, what is it for and how is it codified?
What is .net latest version?
Tell us what is a variable of implicit type and what is its scope?
Usually in .net, the clr takes care of memory management. Is there any need for a programmer to explicitly release memory and resources? If yes, why and how?
Different between .net & j2ee ?
How can I tell if .net 3.5 is installed?
What is garbage collection and how it works. Provide a code example of how you can enforce garbage collection in .net?
How will you do redo and undo in textbox control?
How many design patterns can be created in .net?
Do you know what is the difference between an abstract class and an interface?
How server form post-back works?
Show different types of collection in .NET?
What is garbage collection? Explain the difference between garbage collections in .net 4.0 and earlier versions?
What are an object and a class?