I have a class which holds a private member (which itself is an object). I want to access the member in a legitimate way and modify its properties. The way I thought of doing this is to make the class call a method of my class (where I want to access it) with its private member.
For example, I have class ClassA
which has property mItem
. I want to get the instance of mItem
in ClassB
so that I can call mItem.update()
at a later point of time. From ClassB
, I want to call a method of ClassA
(say, aMethod
) that actually calls some method of ClassB
passing mItem
. However, I want to enforce this, so that aMethod
implementation mandates calling the function of ClassB
with mItem
.
Any ideas?
Aucun commentaire:
Enregistrer un commentaire