views:

30

answers:

1

I have a class named SuperclassA, and an class named ClassA. ClassA inherits from SuperclassA.

SuperclassA has got an property called something, so a very generic not-much-saying name. In ClassA, I want to have an property which maps to that something of SuperclassA.

How could I do that? I want to make absolutely sure that any access to myBetterProperty results in accessing what's behind something.

Assigning an value to myBetterProperty should result in assigning one to something, and vice versa.

How to? Pointers set up in init? How would that look like?

*self.myBetterProperty = &something; ? I'm not sure about that...

+3  A: 

You can declare in your .h:

@property(...) ... myBetterProperty;

and in your .m:

@synthesize myBetterProperty = something;
mouviciel
Error: Property myBetterProperty attempting to use ivar something declared in xxxxxx.h?
dontWatchMyProfile
is `something` declared as @private?
mouviciel
well, it's just declared. no keywords. I guess then it's private...?
dontWatchMyProfile