Experiments in Java


Notes on Session O2: Inheritance

Experiment O2.2, Step 2. The compilation of ExtendedPoint should be successful. If it isn't, you have most likely made a typographical error in entering the code for the new class.

Experiment O2.2, Step 4. It is likely that the Java compiler will complain that you are attempting to use a parameterized constructor for ExtendedPoint when no such constructor exists.

Experiment O2.5, Step 2. ReextendedPoint extends ExtendedPoint. This means that it automatically provides any methods that ExtendedPoint provides. ExtendedPoint extends Point, so it automatically provides all the methods that Point provides. ExtendedPoint also provides a toString method. Hence, ReextendedPoint provides all the methods of Point (getX, getY, etc.) plus toString.


Copyright (c) 1998 Samuel A. Rebelsky. All rights reserved.

Source text last modified Thu Mar 11 16:21:39 1999.

This page generated on Thu Mar 11 16:28:48 1999 by SiteWeaver.

Contact our webmaster at rebelsky@math.grin.edu