Sections


Main-Menu

header image

Polymorphism


Polymorphism

Polymorphism allows the same code to be used with different types, resulting in more general and abstract implementations. A function that can evaluate to and be applied to values of different types is known as a polymorphic function. Similarly, a datatype that contains elements of an unspecified type is known as a polymorphic datatype.

    There are two fundamentally different kinds of polymorphism:
1.    Ad-hoc polymorphism.
2.    Parametric polymorphism.

Ad-hoc polymorphism is a simple overloading. Overloading allows multiple functions with the same name processing different types of data.

In parametric polymorphism a function or a data type is written in such a way that it can process equally any objects without depending on its type.


Related Articles :



Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.

Shaadi.com Matrimony - Register for FREE