Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Superclass vs. Subclass structures
Message
De
29/10/1998 07:41:38
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Divers
Thread ID:
00151975
Message ID:
00152196
Vues:
26
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform