SlideServe
Menu
Préférences
© SlideServe · v2026

Polymorphism

lynna avatar
7 diapositives · 531 Views · Jul 19, 2014

Polymorphism. Bayu Priyambadha, S.Kom. Polymorphism. Poly = Many, Morph = form P olymorphism refers to a principle in biology in which an organism or species can have many different forms or stages

Polymorphism - slide 1
01 / 7Polymorphism
1 / 17

Télécharger la présentation

Polymorphism
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. Polymorphism Bayu Priyambadha, S.Kom

  2. Polymorphism • Poly = Many, Morph = form • Polymorphismrefers to a principle in biology in which an organism or species can have many different forms or stages • Polymorphism is the capability of an action or method to do different things based on the object that it is acting upon • Overloading, overriding and dynamic method binding are three types of polymorphism.

  3. Overloading • Definetwo or more methods within the same class that share the same name, as long as their parameter declarations are different class Overloading {void test() {System.out.println("No parameters");}void test(int a, int b) {System.out.println("a and b: " + a + " " + b);}void test(float a) {System.out.println("Inside test(double) a: " + a);}}

  4. Overriding • Abilityto define a behavior that's specific to the sub class type class Animal { public void move() { System.out.println("Animals can move"); } } class Dog extends Animal { public void move() { System.out.println("Dogs can walk and run"); } }

  5. Dynamic Binding • has definition A mechanism by which, when the compiler can't determine which method implementation to use in advance, the runtime system (JVM) selects the appropriate method at runtime, based on the class of the object • has definition The process of binding a call to a particular method. This is performed dynamically at run-time due to the presence of polymorphism

  6. Static Binding • applies todata valuesand static members • has definition A mechanism by which the compiler determines which method implementation to use in advance, based on the type of the reference (regardless of the actual class of the object)

  7. Thanks...