Polymorphism Encapsulation Inheritance

last modified: April 22, 2004

One of the classical DefinitionsForOo; one which is often accused of being CeePlusPlus centric. A language supports OO programming if it has:


In most ObjectOriented Languages: Polymorphism = Encapsulation + Inheritance

But InheritanceBreaksEncapsulation.

Is PolyMorphism the reason for ObjectOrientation to exist?

No, OO exists because it's a convenient way to structure code and modularize programs. Polymorphism is a key benefit, but not the only one.

There are other ways to achieve Polymorphism, namely ParametricPolymorphism (STL = StandardTemplateLanguage) and Generics (TheRightWayToImplementTemplates).

Generics are ParametricPolymorphism. While JavaGenerics and CppTemplates and DynamicTyping all go about it the same way; they all are ways of implementing ParametricPolymorphism


Loading...