Re: is protected broken, or am I?
Re: is protected broken, or am I?
- Subject: Re: is protected broken, or am I?
- From: matt neuburg <email@hidden>
- Date: Thu, 10 Oct 2002 14:24:27 -0700
>
On 10/10/02 3:23 pm, "Matt Neuburg" <email@hidden> wrote:
>
>
An object (instance of a class) has access to its own ivars and to the
>
non-private ivars of its superclass. (Note that ivars are protected by
>
default.) But this is referring to an instance accessing the internal bits
>
of itself - not the internal bits of some other instance which happens to be
>
of the same class
Right. Well, that's not what I was hoping for.
Let me step back a bit and explain the problem. I have a window. Sometimes when this window appears it behaves a certain way. So the window is in a nib, and the behavior is encoded into an NSWindowController subclass, MyClass, that is the nib's owner. The MyClass instance (File's Owner) and the window are amply endowed with connectors back and forth.
But on other occasions when this window appears it behaves quite a different way. I don't want to put the code for this alternate behavior into MyClass. I'd like to put it into some other class and have an instance of that other class step into MyClass's coat, as it were, taking on all the outlets, and being pointed to by all the window stuff, that the MyClass instance already is set up with in the nib.
This is why I thought of a subclass of MyClass. If there is a better architecture for accomplishing this, I'd be glad to hear it.
(This is the sort of thing that was very easy in REALbasic where windows are classes and you can just make another instance of them - a copy of the window. But there is no Cocoa analogue to that, not least because of all the connector foo, which didn't exist in REALbasic either because everything had a globally visible name.)
m.
matt neuburg, phd = email@hidden,
http://www.tidbits.com/matt
pantes anthropoi tou eidenai oregontai phusei
Subscribe to TidBITS! It's free and smart.
http://www.tidbits.com/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.