Polymorphism-ad
hoc Polymorphism ,
Pure Polymorphism
N SUKRUTHA REDDY
197R5A0514
Content
 What is Polymorphism
 Types of polymorphism
 Ad-hoc polymorphism
 Pure polymorphism
 Advantages
 Disadvantages
Polymorphism
 The word polymorphism means having many
forms. In simple words, we can define
polymorphism as the ability of a message to be
displayed in more than one form.
Real life example of
polymorphism
A person at the same time
can have different
characteristic. Like a man at
the same time is a father, a
husband, an employee. So
the same person posses
different behavior in different
situations. This is called
polymorphism.
Types of Polymorphism
• Compile time polymorphism
• Runtime polymorphism
Compile time polymorphism
It is also known as static polymorphism. This
type of polymorphism is achieved by
function overloading.
Runtime polymorphism
It is also known as Dynamic Method
Dispatch. It is a process in which a function
call to the overridden method is resolved at
Runtime. This type of polymorphism is
achieved by Method Overriding.
Ad-hoc polymorphism
• The ad hoc polymorphism is a technique used to define the same method with different implementations
and different arguments. In a java programming language, ad hoc polymorphism carried out with a
method overloading concept.
• In ad hoc polymorphism the method binding happens at the time of compilation. Ad hoc polymorphism is
also known as compile-time polymorphism.
Pure polymorphism
• The pure polymorphism is a technique used to define the same method with the
same arguments but different implementations. In a java programming language,
pure polymorphism carried out with a method overriding concept.
• Every function call binding with the respective overridden method based on the
object reference.
Advantages
 Code reusability
 Maintainability
 Extensibility
 Reduction in complexity
Disadvantages
 Code harder to read
 More design time

Introduction to java programming polymorphism

  • 1.
    Polymorphism-ad hoc Polymorphism , PurePolymorphism N SUKRUTHA REDDY 197R5A0514
  • 2.
    Content  What isPolymorphism  Types of polymorphism  Ad-hoc polymorphism  Pure polymorphism  Advantages  Disadvantages
  • 3.
    Polymorphism  The wordpolymorphism means having many forms. In simple words, we can define polymorphism as the ability of a message to be displayed in more than one form.
  • 4.
    Real life exampleof polymorphism A person at the same time can have different characteristic. Like a man at the same time is a father, a husband, an employee. So the same person posses different behavior in different situations. This is called polymorphism.
  • 5.
    Types of Polymorphism •Compile time polymorphism • Runtime polymorphism
  • 6.
    Compile time polymorphism Itis also known as static polymorphism. This type of polymorphism is achieved by function overloading.
  • 7.
    Runtime polymorphism It isalso known as Dynamic Method Dispatch. It is a process in which a function call to the overridden method is resolved at Runtime. This type of polymorphism is achieved by Method Overriding.
  • 8.
    Ad-hoc polymorphism • Thead hoc polymorphism is a technique used to define the same method with different implementations and different arguments. In a java programming language, ad hoc polymorphism carried out with a method overloading concept. • In ad hoc polymorphism the method binding happens at the time of compilation. Ad hoc polymorphism is also known as compile-time polymorphism.
  • 9.
    Pure polymorphism • Thepure polymorphism is a technique used to define the same method with the same arguments but different implementations. In a java programming language, pure polymorphism carried out with a method overriding concept. • Every function call binding with the respective overridden method based on the object reference.
  • 10.
    Advantages  Code reusability Maintainability  Extensibility  Reduction in complexity
  • 11.
    Disadvantages  Code harderto read  More design time