11. Inheritance and Polymorphism

 

 

 

 

 

OBJECTIVES

After studying this chapter, you will

Understand the concepts of inheritance and polymorphism.

Know how Java’s dynamic binding mechanism works.

Be able to design and use abstract methods and classes.

Be able to design and use polymorphic methods.

Gain a better understanding of object-oriented design.

OUTLINE

Introduction

Java’s Inheritance Mechanism

Abstract Classes, Interfaces, and Polymorphism

Example: A Toggle Button

Special Topic: Historical Cryptography

Example: The Cipher Class Hierarchy

Case Study: A Two Player Game Hierarchy

Principles of Object-Oriented Design

Chapter Summary

Solutions to Self-Study Exercises Exercises

 

 

 

 

 

 

337

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Figure 8.1: A class hierarchy for horses.