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
Can we override private constructor in java?
How variables are declared?
What is the difference between delete and delete[]
What is a copy constructor in java?
What are the benefits of operations?
how to create daemon thread in java?
Is java a virus?
Difference between string, stringbuffer and stringbuilder?
What are the different types of constructor?
What is the difference between error and an exception?
What is private protected in java?
What is dynamic array in java?
What is the difference between conversation & casting?
Can we call thread start () twice?
What is tcp and udp?