Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Protected & Hidden Properties
Message
De
23/08/1998 22:26:14
 
 
À
23/08/1998 19:34:54
Nancy Folsom
Pixel Dust Industries
Washington, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00129133
Message ID:
00129194
Vues:
19
>Hi, Bernard. If I understand you correctly then it sounds like everything is working the way it is supposed to. A protected property isn't available anywhere outside of its class. Therefore a method in the class can modify the property, but no object that inherits from the class can. You would need to send a message to a class method that say's I want to set a value for oldtop. The method in the class would be responsible for doing it. (i.e. the code to set the property would be in the class.)
>
>HTH
>
>
>>I am confused about custom properties of classes.
>...snip

Nancy you are right. 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
Répondre
Fil
Voir

Click here to load this message in the networking platform