Previous Slide What is Polymorphism? Next Slide

In programming languages, polymorphism means that some code or operations or objects behave differently in different contexts.

For example, the + (plus) operator in C++:

4 + 5       <-- integer addition
3.14 + 2.0  <-- floating point addition
s1 + "bar"  <-- string concatenation!

In C++, that type of polymorphism is called overloading.

Typically, when the term polymorphism is used with C++, however, it refers to using virtual methods, which we'll discuss shortly.


BU CAS CS - Introduction to Polymorphism in C++
Copyright © 1993-2000 by Robert I. Pitts <rip@bu.edu> All Rights Reserved.