WHAT IS?
The object-oriented programming language processes classes and objects by a single interface. It implements the concepts of function overloading, overriding, and virtual functions. Also, it is typically used for instrumenting inheritance in programming.
Types of Polymorphism in Oops
In Object-Oriented Programming (OOPS) language, there are two types of polymorphism as below:
- Compile Time or Static Polymorphis
- Types of All Parameters should be different.
- The sequence of the Parameters can be different.
- The number of parameters of one method should differ from the other method.
- As all of this information is available during the compile time, the compiler selects the appropriate function.
- The function overloading does it, and operator overloading is also termed as static binding or early binding.
In the Dynamic Polymorphism, a call to a single overridden method is solved during a program’s runtime. Method overriding is one of the prominent examples of Runtime Polymorphism. In this process, the overriding is done through pointers and virtual functions.
- In Method Overriding, a single method is declared in a sub-class present in a parent class. The child class gains a method for implementation.
- During Runtime Polymorphism, the class offers the specification of its own to another inherited method. This transfer between methods is achieved without modifying the parent class object codes.
Comentarios
Publicar un comentario