/** * Stuff that you might try to flush down a toilet.

* * We'll distinguish among a few different varieties of waste by * having different subclasses. But none of the Waste classes * currently have any interesting fields or methods, since the toilet * doesn't need to do anything interesting with the waste, just erase * it.

* * If we decided our program should follow the waste through the * sewage system and process it, then we could add details to the * class: *

* * @author Jason Eisner * @version 1.0, 2003-01-26 */ public class Waste { protected String description; /** The constructor; we could add others. * @param s A description of the waste. */ public Waste(String s) { // constructor (could have others) description = s; } /** To get a printable version of the waste, we just * use its description string. This overrides the default * toString() method inherited from Object. */ public String toString() { return description; } /** This is a convenience function. If w is some * waste and t is a toilet, then * w.deposit(t) is the same as t.deposit(w). * * @param t The destination. */ public void deposit(Toilet t) { t.deposit(this); } }