What is Function polymorphism and Class Polymorphism ? Difference ? Why we need it ?

Posted by Nav234 under C# on 7/8/2010 | Views : 2814 | Status : [Member] | Replies : 3
Hi all ,

What is Function polymorphism and Class Polymorphism ? Difference ? Why we need it ?

Under which polymorphism,Method overloading ,overriding concepts come .

What are the other polymorphism sub types ,example ?

Thanks in advance

S.Naveen...


Responses

Posted by: Poster on: 7/8/2010 [Member] Starter

Up
0
Down
Function polymorphism is a kind of overloading and overriding. Class polymorphism is like inheriting parent class / interface and instantiating the subclass with parent class / interface.

Runtime polymorphism - overriding
Compile time polymorphism - overloading

You can have a look at following article for more details.
http://www.dotnetfunda.com/articles/article258.aspx
http://www.dotnetfunda.com/articles/article505-what-is-polymorphism-.aspx

Hope this help.

Thank you.

Nav234, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Dhirendra on: 7/18/2011 [Member] Starter | Points: 25

Up
0
Down
I believe that both overriding & overloading are compite time polymorphism as when we compile the application it knows which method to call in case of overriding.
so what I think is that runtime time polymorphism is when we use interface/abstract class with the similar behaviour and pass/use that interface in other classes (e.g. through depedancy injecttion, inversion of control) and that class only knows about the behaviour/interface but dont know the exact object at compile time and only knows at runtime.





Nav234, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Dhirendra on: 7/18/2011 [Member] Starter | Points: 25

Up
0
Down
I believe that both overriding & overloading are compite time polymorphism as when we compile the application it knows which method to call in case of overriding.
so what I think is that runtime time polymorphism is when we use interface/abstract class with the similar behaviour and pass/use that interface in other classes (e.g. through depedancy injecttion, inversion of control) and that class only knows about the behaviour/interface but dont know the exact object at compile time and only knows at runtime.





Nav234, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response