13.1 INTRODUCTION

One of the useful features of object-oriented programming is polymorphism. It is the ability of the objects to take different forms. The ability to display variable behaviour depending on the situation is a great facility in any programming language. In C++, polymorphism appears in three entities.

  1. Operators
  2. Function
  3. Objects

In an earlier chapter, we have seen operator overloading. Here, one operator say plus sign produces different actions in case of integers, complex numbers or strings. This is a type of polymorphism.

We have also seen function overloading. Two functions having same names will have different actions depending on the nature of parameters passed. This is also a type of polymorphism.

Now, we will study polymorphism ...

Get Object Oriented Programming with C++, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.