Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Hiding methods/properties from users.
Message
De
30/07/2002 03:52:08
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Divers
Thread ID:
00683150
Message ID:
00683833
Vues:
22
This message has been marked as the solution to the initial question of the thread.
>I have 2 classes (CLASS1 and CLASS2). A CLASS1 object (OBJECT1) will instantiate a CLASS2 object (OBJECT2) and store a reference to it in one of it's properties (OBJECT1.OBJECT2)
>
>I want to be able to manipulate a property of the OBJECT2 from within OBJECT1 (OBJECT1.OBJECT2.ID = 3 or OBJECT1.OBJECT2.SETID(3)) but I don't want someone to be able to programatically do that.
>
>In other words, within OBJECT1 I want to be able to do the following:
>
>function update
> ...
>
> OBJECT2.ID = 3 && or OBJECT2.SETID(3)
>endfunc
>
>but I don't want to be able to do this from the command line:
>
>OBJECT1.OBJECT2.ID = 3
>OBJECT1.OBJECT2.SETID(3)
>
>Is this possible? I've tried making ID a protected property of CLASS2 but that makes it impossible for OBJECT1 to access it.
>
>Grateful for whatever help you can offer!

Rod,
Even if you do everything hidden in object1 someone could directly get a reference for object2 and operate on it. If he can't for object2 hides/protects too then object1 can't access either.
However if you're sure object2 would always get a reference through object1 you could protect the reference itself.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform