Java Reference
In-Depth Information
CHAPTER
8
Polymorphism and Abstraction
Two important effects that stem from inheritance in object-oriented program-
ming (OOP) are polymorphism—where an object can take on many forms—
and abstraction—allowing for the creation of abstract classes. This chapter
discusses both of these OOP concepts in detail and how they are implemented
in Java.
An Overview of Polymorphism
When we discussed inheritance, I explained how the is a relationship is used to
determine if your inheritance is a good design. The is a relationship is also help-
ful when learning polymorphism. Polymorphism is the term used to describe
how an object can take on many forms. An object takes on many forms because
an object can be treated as a child type, a parent type, a grandparent type, and
so on up the hierarchy tree.
The term polymorphism is a combination of poly , meaning many or
multiple, and morph , meaning shapes or forms. Polymorphism in OOP
refers to the ability of an object to have many forms, which is a direct
result of inheritance.
213
Search WWH ::




Custom Search