0 votes
in JAVA by
What is Polymorphism?

1 Answer

0 votes
by

The basic idea behind polymorphism is in many forms. In C++, we have two types of Polymorphism:

(i) Compile-time Polymorphism

In compile-time polymorphism, we achieve many forms by overloading. Hence, we have an Operator overloading and function overloading. (We have already covered this above)

(ii) Run-time Polymorphism

This is the polymorphism for classes and objects. General idea is that a base class can be inherited by several classes. A base class pointer can point to its child class and a base class array can store different child class objects.

This means, that an object reacts differently to the same function call. This type of polymorphism can use a virtual function mechanism.

Related questions

+1 vote
asked Jan 24, 2021 in JAVA by rajeshsharma
0 votes
asked May 25, 2020 by Robindeniel
...