Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Protected & Hidden Properties
Message
 
À
23/08/1998 11:53:41
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00129133
Message ID:
00129184
Vues:
28
Bernard,

You are confused about what a protected property is. A property may be public, meaning that other objects can assign and read its value or it can be protected meaning that other opbjects cannot read or asign it a value. You protect your properties from users by not giving them any way to change the property.

Hidden properties don't work correctly in VFP 5.0 or earlier. Where a protected property is untouchable by other objects, a hidden property is untouchable by subclasses.

When would you use a protected property, when you need an object tos tore some values regarding its current state and you don't want any code in any other object to be able to change that value. You make the property protected and provide a method for reading or assign values to the protected property.

When might you want a property to be hidden, when the property is used by one class in the hierarchy and subclasses should not be able to alter the properties values. This is often done in frameworks to allow subcl;assing as a method of enhnancement without any danger of the developer accidently mucking up the super classes state.

In VFP 5.0 hidden properties are useless as they don't work right. VFP6.0 fixes them and makes them useful for the purpose of their design.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform