|
||
|
Lesson 1
Ad hoc polymorphism
|
||
|
This module introduces you to the concept of polymorphism and why it is essential to designing code
that requires little modification when
functionality is added. you will learn:
In object-oriented programming, polymorphism refers to a programming language's ability to process objects differently depending on their data type or class.
Furthermore, it is the ability to redefine methods for derived classes.
Example: Given a base class shape, polymorphism enables the programmer to define different
area methods for any number of derived classes,
such as circles, rectangles and triangles. No matter what shape an object is,
applying the area method to it will return the correct results.
Polymorphism is considered to be a requirement of any true object-oriented programming language (OOPL).
|
||
|
|
||