Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Superclass vs. Subclass structures
Message
From
29/10/1998 07:41:38
 
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00151975
Message ID:
00152196
Views:
25
Hiya Nick ---

Very, very good point. Engines, brakes, and wheels could have their own superclasses, after all, they behave differently on different vehicles. Soo...this makes the instances composite objects, eh?


>I would vote for option 2.
>
>But your Vehicle class should be of Container type.
>
>vhlCar.Init()
>this.AddObject("DriveTrain","engInternalCombustion", 6, V )
>this.AddObject("brkDisc","brkBrake", 2 ) && 2 - DiscVent
>this.AddObject("whlWheel","whlCar", 4, 14 ) && 14"
>*
>*
>vhlCar.Move(1) && 1 - Forward)
>
>***Move() Method
>lparameter tlWhere
>local llReturn
>IF this.brkDisc(0)
>    llReturn = this.DriveTrain(tlWhere)
>ENDIF
>RETURN llReturn
>
>And don't forget to set vhlCar.WhereTo property... :)
------------------------------------------------
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