>Having a property or method that is not in the parent class can be indicative of a poor class design. The purpose of the highest class level is to define the public interface for all of its subclasses. Introducing a new property or method down the inheritence tree causes the interface to change within the particular class.
I would say that was a little extreme, Jim. All that's necessary is that the child is-a parent. It's not necessary that a parent is-a child (with respect to interface).
There are two main reasons to subclass: specialization and extension. Both reasons allow adding private/protected properties and methods. The second reason allows adding public methods.
What you're describing is called "class flattening," and can itself be indicative of bad design.
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement