Flashcards
Polymorphism
Cards in this deck (5)
- 1What means Polymorphism literally?It means many forms
- poly means many
morph means form - 2What is Polymorphism?It is a concept by which we can perform a single action in different ways
- 3Which types of Polymorphism is there?-Compile Time (Static)
-> can be archived by Method Overloading or Constructor Overloading
- Runtime (Dynamic)
-> can be archived by Method Overriding - 4How can Method Overloading or Constructor Overloading be archived?- By keeping the same method name and changing:
-number of parameters
-type of parameters
- order of parameters
Da der Compiler immer eine Methode basierend auf dem Kontext in der gleichen Klasse auswählt, ist Overloading nicht für Methoden in unterschiedlichen Klassen vorgesehen. - 5How can Method Overriding be archived?Runtime Polymorphism
Runtime (Dynamic)
Method Overriding
- Can be archieved in Inheritance by reimplementing the parent class method in Child class
class: printer
print() {
Syso("Welcome);
};
class Greeter inherits from printer class
@Overriden
print(){
Syso("HI");
}
Information
- Description
- Flashcards on Polymorphism, created by BLU BLU on 13/01/2025.
- Created by
- BLU BLU
- Views
- 1
- Rating