Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Class Method Visibility
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00554548
Message ID:
00554612
Vues:
9
This message has been marked as the solution to the initial question of the thread.
>>>I'm a bit confused - can somebody please shed some light.
>>>
>>>I have created a class that has various methods ie FillList
>>>Now if this is set as public then all is fine. If however I change this to Protected or Hidden then an object on a form created from this class no longer works.
>>>
>>>The only call to FillList is within the original Class definition.
>>>
>>>So what exactly is the point of Protected and Hidden?
>>
>>Protected properties, events and methods (PEMs) can only be accessed by the object itself. Outside objects can not access them. This is useful if you have an internal process that must take place in a certain order. You expose the Parent method so objects can execute it. It then makes the internal calls so the process runs smoothly.
>>
>>Hidden PEMs extend this non-accessibility to subclasses of the object. Only the original class itself can access hidden PEMs. Subclasses can not. This is useful when distributing classes and you don't want the public interface "gummed up" with useless PEMs or you don't want the code changed. For example, if you subclass the Custom object to make a business object class, you may not want to see methods like CloneObject or SaveAsClass in the property sheet. You can hide these and the property sheet will only show those methods that the developer can access and change.
>>
>>HTH.
>
>Larry,
>
>That all makes sence in the reading and I thought that that was what I was doing but....
>
>Basically I have a class with a FillList Method. Now an object within this control class calls the FillList method when clicked on.
>
>When I use this class in my form if FillList is Protected or Hidden then when you press the button an error occurs.
>
>How else do I make up composite controls with Hidden methods?

As I already said here, protected and hidden properties do not work across the objects containership. They ok only for a single object as the class.

Well, there is a technique to hide the logic from users of your class - create proeprties in run-time using AddProperty() method of object in the Init of the object. This way users will never see these properties in design time, only in run-time. But this also a help - there will be no huge number of properties that used only for communication between objects and have no any value for programmer that use that class.
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform