1/17
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Polymorphism
is a concept in object-oriented programming that allows objects of different classes to be used interchangeably, while still maintaining their own unique behavior. This means that objects of different classes can respond to the same message or method in different ways.
Polymorphism
allows to use a single interface to represent different objects that share a common behavior.
Poly
means "many"
Morph
means "Take different forms"
Static, dynamic
two types of polymorphism
Static
______ polymorphism, also known as compile time polymorphism, refers to the ability of the compiler to determine which method to call at compile time based on the arguments passed to the method.
Static
______ polymorphism is achieved through method overloading, where multiple methods in the same class have the same name but different parameters.
Dynamic
_______ polymorphism is achieved through method overriding, where a subclass provides a different implementation of a method that is already defined in its superclass.
Dynamic
_______ polymorphism, also known as runtime polymorphism, refers to the ability of objects to respond to the same message with the appropriate method based on their class definition at runtime.
Static, dynamic
method overloading, constructor overloading, and method hiding is to ______ polymorphism, as method overriding is to _______ polymorphism
Binding
refers to the process of associating a method or function call with its implementation at runtime.
Binding
The connecting (linking) between a method call and method body/definition
Static, dynamic
There are two types of binding in Java: ______ binding and _______ binding
Static binding
Occurs when the method to be called is determined at compile time. This happens when the method being called is a static method, private method, final method or a constructor.
Static binding
The compiler can determine which method to call based on the method signature and the static type of the object on which the method is being called.
Static binding
This binding is also known as early binding because it takes place before the program actually runs. An example of it is method overloading
Dynamic binding
Also known as late binding or runtime binding, occurs when the method to be called is determined at runtime. This happens when the method being called is a non-static method and the actual type of the object on which the method is being called is not known until runtime.
Dynamic binding
is also called late binding or runtime binding because binding occurs during runtime. An example of it is method overriding.