>John,
>
>Very good arguments, but you didn't discuss the benefits of MULTIPLE interfaces.
>
Here's one.. Imagine you have an abstract entity class and an abstract printing class. I know want to create a customer class capable of printing out a variety of reports. With multiple interfaces, I can create a customer class that implements both the entity and printing classes.
>Also, inheritance is not necessary for polymorphism (a common misconception). Polymorphism simply says that two different operations can have the same name (Ad Hoc Polymorphism), and that can be done in FoxBASE. Well with a good deal of library management.
>
>The other polymorphism is inherent polymorphism, which is descriptive of inheritance and not a result of inheritance. Inherent polymorphism says that all members of a class share some or all of the properties and methods of the superclass.
>
But in the OO world, the common way of implementing polymorphism is through inheritance. At least, most examples illustrate it in that light. Perhaps that is why inheritance is the most used/abused feature in OOP.
>I know this is nit picking, but I just wanted it to be said lest others start thinking that inheritance is what allows polymorphism. In fact, the opposite is true, polymorphism is what defines inheritance.
>
No.. those are good points to bring up.
>Inheritance, when used well, is often only defining an interface. When misused it is specialize behaviors, something that is much better served through strategy and bridge patterns among others.
<
Exactly, and I think that is the point the Walter Meester is attempting to make here...
Précédent
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