Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Creating a Read Only Custom Property
Message
De
23/04/1998 08:35:38
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00094263
Message ID:
00094282
Vues:
35
But look at why you are protecting it. One reason may be that you want it
read-only another may be that you want to secure both read and write
based on some condition such as security or developer level. Also,
it may be that multiple properties may work together and you do not
want another developer to incorrectly select a property just because
the name of the variable appears to be what they want. This is
a very good mechanism to enforce object encapsulation. You are
now really doing the object thing with everything be messages and
replies.

-myron kirby-
===================================================
>That's exactly what I did but it seems a bit of an overkill to create a method to return a property value instead of just looking at the property value!
>
>>Leave the property protected and then create a custom method (i.e. RdSecLev) to read and return the value. Then
>>when you want the value of the property use a call to the method (i.e. lcSecLev = oSec.RdSecLev).
>>
>>-myron kirby-
>>myronk@flash.net
>>================================
>>>Is there any way of creating a read-only custom property in a subclass? I have tried setting the property to Protected, but in the exe it is not found. I am populating the property via a method in the same subclass and want to compare the contents at different intervals but I want the property to be read-only. The only way of reading the contents would be to make it public - I don't want that!
----------------------------------
-myron kirby (mkirby2000@gmail.com)-
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform