Re: Accessing private members of another object of the same class

2009-01-26 Thread Horst Jäger
First of all: thank you. You solved my problem. There's no real way to enforce privateness, either in Objective-C or C++. Why not in C++? Yes, these do the trick. But another-mineAlone will. -(int)yoursTooButWithAnother: (PrivateClass *)another { return

Re: Accessing private members of another object of the same class

2009-01-26 Thread Jeremy Pereira
On 26 Jan 2009, at 14:02, Horst Jäger wrote: First of all: thank you. You solved my problem. There's no real way to enforce privateness, either in Objective-C or C++. Why not in C++? #define private public class Foo { private: int privateVar; } ;

Re: Accessing private members of another object of the same class

2009-01-26 Thread Jean-Daniel Dupas
Le 26 janv. 09 à 15:02, Horst Jäger a écrit : First of all: thank you. You solved my problem. There's no real way to enforce privateness, either in Objective-C or C++. Why not in C++? And why not in Obj-C ? The new runtime (64 bits, non-fragile) declare a symbol for each ivar.

Re: Accessing private members of another object of the same class

2009-01-26 Thread glenn andreas
On Jan 26, 2009, at 8:14 AM, Jean-Daniel Dupas wrote: There's no real way to enforce privateness, either in Objective-C or C++. Why not in C++? And why not in Obj-C ? The new runtime (64 bits, non-fragile) declare a symbol for each ivar. Private ivars are not exported by default, so

Re: Accessing private members of another object of the same class

2009-01-26 Thread Bill Bumgarner
On Jan 26, 2009, at 7:24 AM, glenn andreas wrote: The layout for 64 bit new runtime objects is not defined (and due to the non-fragile part, isn't even fixed at compile or link time, so you'd have to munge your way through undocumented data structures - better off just using KVC). Or the

Re: Accessing private members of another object of the same class

2009-01-26 Thread Scott Ribe
Why not in C++? Same as Objective-C, another instance of the same class can access them (as can static methods of the class)... -- Scott Ribe scott_r...@killerbytes.com http://www.killerbytes.com/ (303) 722-0567 voice ___ Cocoa-dev mailing list

Accessing private members of another object of the same class

2009-01-23 Thread Horst Jäger
Hi, suppose I have a class with a private member as listed at the end of this email. Then I can access it by calling its name without an accessor function (which would de facto make it public). But how do I access a private member of another object of the same class? Or does

Re: Accessing private members of another object of the same class

2009-01-23 Thread Quincey Morris
On Jan 23, 2009, at 13:01, Horst Jäger wrote: But how do I access a private member of another object of the same class? Like this: -(int)yoursTooButWithAnother: (PrivateClass *)another { return another-mineAlone % 3; } Also, be careful to keep two things separate in your mind.

Re: Accessing private members of another object of the same class

2009-01-23 Thread Ken Thomases
On Jan 23, 2009, at 3:01 PM, Horst Jäger wrote: suppose I have a class with a private member as listed at the end of this email. Then I can access it by calling its name without an accessor function (which would de facto make it public). But how do I access a private member of another