Home Segments Index Top Previous Next

597: Practice

Implement shouldNotImplement:, a method defined for the Object class. When sent to an instance of any class, shouldNotImplement: is to use the error: message to send an error message that opens an error window with the following title:

The the class should not implement the argument 

Then, using shouldNotImplement, define < for the Food class, such that any attempt to use < on a food or on an instance of any of, say, the Vegetable subclasses of the Food class, prints the following:

The Vegetable class should not implement <