C++ Programming Question: Download C++ Programming PDF

What is polymorphism in C++? Explain with an example?

Tweet Share WhatsApp

Answer:

"Poly" means "many" and "morph" means "form". Polymorphism is the ability of an object (or reference) to assume (be replaced by) or become many different forms of object.
Example: function overloading, function overriding, virtual functions. Another example can be a plus ‘+’ sign, used for adding two integers or for using it to concatenate two strings.

Download C++ Programming PDF Read All 120 C++ Programming Questions
Previous QuestionNext Question
What do you mean by pure virtual functions?How can you quickly find the number of elements stored in a a) static array b) dynamic array ?
Why is it difficult to store linked list in an array?
How can you find the nodes with repetetive data in a linked list?