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
Tell us what is the native image generator?
What is the difference between a class and an object, and how do these terms relate to each other?
How inheritance works in .net?
Explain the difference between managed and unmanaged code?
What is namespaces in .net?
What does cil do?
Please explain what garbage collection is and how it works. Provide a code example of how you can enforce garbage collection in .net?
How many types of generations are there in a garbage collector?
what is the keyword used for self reference?
What is immutability?
How we can achieve Connection pooling in .Net?
What is a strong name in .net?
Explain what is an anonymous method and how is it different from a lambda expression?
What is difference between .net and .net core?
How many namespaces are in .net version 1.1?