Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Protected & Hidden Properties
Message
De
23/08/1998 22:30:39
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00129133
Message ID:
00129196
Vues:
29
>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.
>

This fixes some of the confusion.
This is the behavior I too observed. What puts me off is that on pages 50 - 51 of the Developers Guide, they talk about classes
and make ref. to the SAMPLES\StopWatch class. Part of the code is as foll:


** Start code snippet
THIS.Parent.nSec = THIS.Parent.nSec + 1IF THIS.Parent.nSec = 60 THIS.Parent.nSec = 0 THIS.Parent.nMin = ; THIS.Parent.nMin + 1ENDIF
Increment the nSec property every time the timer event fires: every second.If nSec has reached 60, reset it to 0 and increment the nMin property.

IF THIS.Parent.nMin = 60 THIS.Parent.nMin = 0 THIS.Parent.nHour = ; THIS.Parent.nHour + 1ENDIFTHIS.Parent.UpdateDisplay If nMin has
reached 60, reset it to 0 and increment the nHour property.

**End snippet

As you can see from above and from the manual, the PROTECTED Properties nSec,nMin,nHour are accessed from the tmrSwatch.Timer event.This
cannot be as As per your explanation above, the timer event MUST call a method in the class!

When I look at the actual class code in the above mentioned class It is as you have described. Does this mean that the Developers Guide is wrong?? I
initially based my assumptions on the manual but it is wrong.The tmrSwatch object has been added to the original class as cannot see the classes
protected members.

Again from the manual page 49...

"Properties and methods that you designate as Protected can be accessed only by other methods in the class definition or in subclasses of the class."

what do they mean by "subclasses of the class".??
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform