Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Superclass vs. Subclass structures
Message
De
29/10/1998 09:10:55
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Divers
Thread ID:
00151975
Message ID:
00152249
Vues:
26
Hiya Mark ---

>
>I don't mean to sound critical, but I think this would be a bad approach. First, this is actually what I'd call a strategy, and strategies are best used when they can change at runtime. For static behavior that can be determined at compile-time, you just create the correct object in the first place. A "type" field (and its associated Case and If statements) is just what you want to avoid in OOP.

I gotta back up Marty a bit here. While I don't necessarily completely agree with his solution, it does adequately reflect that to support polymorphism, you have to have some branch logic somewhere.....although I would keep all that intrinsic to the object itself (and there is where I differ I guess).
------------------------------------------------
John Koziol, ex-MVP, ex-MS, ex-FoxTeam. Just call me "X"
"When the going gets weird, the weird turn pro" - Hunter Thompson (Gonzo) RIP 2/19/05
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform