next up previous
Next: 1.4.3.1 An Extended Example Up: 1.4 Java Classes and Previous: 1.4.2 Instantiating Class Definitions

1.4.3 Defining Functional Methods in Java

In Section 1.4.1, we showed how to represent an inductive data definition in Java using an abstract parent class and a collection of variant subclasses. But we did not show how to express operations on that form of data.

Each such operation can be represented as an abstract method in the abstract class for the inductive data definition. In each concrete variant extending the abstract class, a concrete definition for the method is provided.



 

Robert Cartwright, Spring 1999