Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Superclass vs. Subclass structures
Message
From
29/10/1998 09:10:55
 
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00151975
Message ID:
00152249
Views:
25
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform