Home Segments Index Top Previous Next

241: Mainline

You could, of course, define isVegetable for the Object class, rather than for the Food class. Generally, however, you should define such a predicate for the lowest class in the class hierarchy that is a superclass of all classes whose instances are possible receivers of the predicate; otherwise, you clutter up the definition of the Object class and confound your use of the file-out mechanism, described in Chapter••missing reference••.