If you find a number of classes doing the same thing, you might "generalize" that common behavior into a common superclass. If you find one class doing different things you might "specialize" the unique behavior into new subclasses. These are neat ways to think about how you find the need for inheritance.
Those conditions I mentioned are not complete and sufficient, but hints as to when to think about inheritance. Or composition
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
posted 13 years ago
Thank you... You have been really helpful... My revision is going well... hopefully I will pass the exam on friday... these past paper questions are hectic... but I understand what you mean by specialisation and generalisation. Thank you Stan