• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: is protected broken, or am I?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >Re: is protected broken, or am I? (From: Cameron Hayne <email@hidden>)

  • Prev by Date: Re: Wrapping C
  • Next by Date: Re: why mouseMoved doesn't work...
  • Previous by thread: Re: is protected broken, or am I?
  • Next by thread: Re: is protected broken, or am I?
  • Index(es):
    • Date
    • Thread