< Zurück | Inhalt | Weiter >

Do I need this class?

We are often tempted to create too many inherited classes. When we seek more generic, higher level abstractions, it is often possible to use only the more abstract class. Of course, it is possible to carry that tendency too far. If your methods contain a lot of “if’s” to handle various subtypes, that might be a case where you should inherit and overload the method.