Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Superclass vs. Subclass structures
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Divers
Thread ID:
00151975
Message ID:
00152120
Vues:
24
>Also the use of a consistent interface is helpful, in your traffic example, when there may be more than one driver class to control the automobiles. perhaps you need a taxi driver, a teenage driver, a race car driver etc.

Absolutely. If the app needed to model drivers, then it should do so. Only the app can decide; this can't be determined a priori.

For example, a programming project at school was to create a simulation of computer lab use. The objects were students, computers and TAs. A more detailed simulation could have also modelled class schedules, bed times, midterm times, etc. Since you can't model the entire world (even if it would make the model more accurate), you have to decide based on the needs of the application.

>If each one had to talk to its vehicle in a different way then you would preclude any kind of generic code in the driver classes because there was no consistent interface to the vehicles.

Actually, the example I gave used the option with the generic Move method.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform