When a class decides to implement an interface or extend another class it
- vows to define certain methods, to implement the "policy" determined by that interface/class
- admits a similarity between itself and other classes which have implemented that same interface/extended that same class in the past
what is all this jargon?
Here's an example: We have a class called "Animal" that declares that it can Eat, Sleep, and Play. Well, a Cat can do these things, and so can a Dog. So both classes (Cat and Dog) decide that they're going to extend the Animal class. Therefore a Cat and a Dog are both Animals. By declaring that they're both Animals, therefore, we can assume that both a Cat and a Dog will be able to respond to a general call to Eat, Sleep, or Play. Futhermore, we can be assured that Cats and Dogs will Eat, Sleep, and Play in a similar manner-- since they are both Animals.
( i write | i program | i have a homepage | i take an english class )