Try OpenEdge Now
skip to main content
Guide for New Developers
An overview of ABL : Object-Oriented Concepts Overview : Polymorphism
 

Polymorphism

Polymorphism is one of the most powerful advantages of object-oriented programming, and it relies fundamentally on inheritance and overriding. When a message is sent to an object, the object must have a method defined to respond to that message. In an inheritance hierarchy, all subclasses inherit the methods from their super class; each subclass however may require a separate response to the same message, as each subclass is a separate entity.
Polymorphism allows the message in the superclass to be dispatched to the method in the subclass at runtime. In other words, Polymorphism means that objects in a class hierarchy can respond to the same message in different manners. For example, when you have a system with many shapes, each shape—for example, a circle, a square, or a star—is drawn differently. By using polymorphism, you can send each of these shapes the same message (for example, Draw), and each shape would be responsible for drawing itself.
For more information on Object-oriented programming, see the guide OpenEdge Development: Object-oriented Programming.