Compile Time Polymorphism || Lesson 65 || Java Programming || Learning Monkey ||

preview_player
Показать описание
Compile Time Polymorphism
In this class, We discuss Compile Time Polymorphism.
The reader should have prior knowledge of method overloading in Java. Click Here.
Polymorphism: Polymorphism means the same entity performing different operations in different scenarios.
Example:
class A
{
void m1()
{
}
void m1(int a)
{
}
}
class test
{
public static void main(String args[])
{
A ob = new A();
ob.m1();
ob.m1(2);
}
}
We have two methods with the same name, m1.
The logic in both methods is different.
The same method, m1, working with different logics is called polymorphism.
Method overloading is called compile-time polymorphism.
Compile time polymorphism means identifying which method to execute during compile time.
The method names are the same in method overloading, but the signature is different.
Identification is done by using the signature during compile time
When calling the method m1(2), we will use the second m1 method.
The parameters match the second m1 method.
In our next class, we discuss run-time polymorphism.

Link for playlists:

Рекомендации по теме
Комментарии
Автор

Helpful videos.. I wish you produce videos for Database Fundamentals (Relational and OO) & DBMS

mos