what is polymorphism with example?types of polymorphism?
Answer Posted / hassan arafat
Polymorphism allows an entity (for example, variable,
function or object) to take a variety of representations.
Ad-hoc polymorphism: This polymorphism let a function to
have different implementations based on its parameters and
return type. Ad-hoc polymorphism is supported through
function and method overloading.
Parametric polymorphism: lets you write a piece of code
that is not associated with a particular type and therefore
can be used with any type. Object oriented languages like
C# achieve it through generics.
Inclusion polymorphism: let a type hold instances of many
different types as long as the types are related by some
common parent class. Object oriented languages like C#
achieve inclusion polymorphism through inheritance.
Is This Answer Correct ? | 33 Yes | 11 No |
Post New Answer View All Answers
What is <> used for in java?
How do you compare two strings lexicographically?
What are class members by default?
is it possible to instantiate the math class?
What is definition and declaration?
Why do we need autoboxing in java?
Explain about the dynamic behavior of core java?
How big is a 32 bit integer?
What are multiple inheritances? Is it supported by java?
What is the difference between yielding and sleeping in java programming?
How do you compare values in java?
Is a case study a method or methodology?
Is static a singleton?
Can private class be inherited in java?
Explain the inheritance?