Just my opinion,
9 times out of 10 inheritance is the wrong tool for the job. In the case where there is desired reuse of functionality it is usually a better solution to use encapsulation (has a rather than is a). There are cases where inheritance is very useful, however you should think carefully before using it, and make sure that superclasses are written with inheritance in mind.
Joshua Bloch's book Effective Java covers several of those points. |