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

Bernard,

I guess the Dev Guide is wrong because Protected has nothing to do with classes, it has to do with objects.

This may be complicated, but class code NEVER runs. The methods and properties are used to create an instance of the class (Object) the object runs its code. A protected property is protected from other objects (even other objects from the same class).

Imagin a class named Junk with a protected property named Prot.

oJunk = CREATEOBJECT("Junk")
oJunkA = CREATEOBJECT("Junk")

Then in oJunkA you have a line of code that says;

oJunk.Prot = "ABC"

That code will fail with a error because Prot is protected inside of oJunk and cannot be addressed from oJunkA, which is a different object.

An Object can access all of its protected properties.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform