Information générale
Catégorie:
Programmation Orientée Object
To quote Grady Booch, it depends on the application. :)
However, some general comments can be made, I guess. I think we'd all try to avoid 1), since that would mean modifying the base class every time a new method of locomotion was introduced. 4) would not be suitable if in fact there was common functionality for Vehicles in the app. The choice between 3) and 4) would depend on who is moving the objects, and why. If you were simulating city traffic patterns, e.g., then you might not actually care how the moving was done, you just know that every cycle, everything needs a chance to move itself.
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