|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--Waste
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:
SolidWaste
.count and TrashWaste
.isBiodegradable.
Field Summary | |
protected java.lang.String |
description
|
Constructor Summary | |
Waste(java.lang.String s)
The constructor; we could add others. |
Method Summary | |
void |
deposit(Toilet t)
This is a convenience function. |
java.lang.String |
toString()
To get a printable version of the waste, we just use its description string. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected java.lang.String description
Constructor Detail |
public Waste(java.lang.String s)
s
- A description of the waste.Method Detail |
public java.lang.String toString()
toString
in class java.lang.Object
public void deposit(Toilet t)
w
is some
waste and t
is a toilet, then
w.deposit(t)
is the same as t.deposit(w)
.
t
- The destination.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |