Imagine that the aquarium in the Aquarium Lab Series could hold more than just fish. We could create a simple superclass,
AquariumObject, that implements the following methods:
int id(): get the object's IDvoid act(): does nothing, but can be redefined in subclasses to act/move in whatever way is appropriate for the object- possibly other methods, such as
toStringSubclasses of
AquariumObjectmight include:
AquaFishCrab,Seahorse,Shrimp: each would move differently- (Large municipal aquarium):
Whales,Dolphins,PenguinsCoral,Sea Grasses,KelpRocks(might just inherit the do-nothingmovemethod)