Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Control Object vs. Container Object
Message
 
 
À
19/04/2018 11:00:36
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
01659539
Message ID:
01659542
Vues:
96
>Hi all!
>
>What are the basic advantages to use the Control Object in using the Container Object?
>
>Is it faster?
>Or is it only the encapsulation?

Control is more "puristic" in that it hides all objects from outside reference, so it helps you to write more manageable code.

If you had a timer control on the container it would be like:
loContainerObject = Newobject("MyContainer","Classlib.vcx")
loContainerObjecct.tmr.Enabled = .T.
With a control it properly hides the timer and you need to create a method on the control:
loControlObject = Newobject("MyControl","Classlib.vcx")
loControlObject.Start()
Latter is the better solution, because the calling object should not need to understand the inner plumbing of the object's logic. This is the same logic in C# for instance, so other developers might be more familiar with it.
Christian Isberner
Software Consultant
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform