September 2001
Beginner
698 pages
13h 46m
English
Inheritance is a powerful tool. Today you will explore the use of this new tool through a number of hands-on lab exercises. By the end of today’s lesson, you should feel a bit more comfortable with the theory presented on Day 4.
Today you will learn
How to use inheritance while programming
How abstract classes help you plan inheritance
About the importance of the “Is-A” and “Has-A”
How Java may have violated the “Is-A” and “Has-A” relationship
Listing 5.1 presents the personified MoodyObject baseclass.
Example 5.1. MoodyObject.java
public class MoodyObject { // return the mood protected String getMood() { return "moody"; } // ask the object how it feels public void queryMood() { ...Read now
Unlock full access