Re: superclass and awakeFromNib
Re: superclass and awakeFromNib
- Subject: Re: superclass and awakeFromNib
- From: matt neuburg <email@hidden>
- Date: Sat, 14 Dec 2002 07:48:59 -0800
>
When -[DummyViewA awakeFromNib] is called with [aDummyViewB
>
awakeFromNib], the "self" pointer still points to an instance of
>
DummyViewB. Therefore [self superclass] will be DummyViewA.
>
>
"super," however, still refers to the implementation in the superclass
>
of the current implementation
>
>
On Saturday, November 30, 2002, at 10:52 AM, Simon Bovet wrote:
>
>
>
>
> -(void)awakeFromNib
>
> {
>
> if ([[self superclass]
>
> instancesRespondToSelector:@selector(awakeFromNib)])
>
> [super awakeFromNib];
>
> }
The real problem is that the docs on awakeFromNib seem to imply that Simon's formula, which is quoted directly from those docs, acts as a general incantation that can be put at the start of every awakeFromNib to ensure that the super's awakeFromNib will be invoked if it has one. And, for the reasons that Fritz gives, that's false.
So my question is: *is* there a general incantation that can be put at the start of every awakeFromNib to ensure etc. etc. etc.? Yes, I know I can consult the runtime, my own code, and so on, and just call [super awakeFromNib] if the superclass has an awakeFromNib implementation and not call it if it doesn't; but that's a huge pain, especially when your code has subclasses its own classes a lot. I'd like the computer to do the work, not me. It would be nice to have an expression one can just paste at the start of every awakeFromNib to ensure that the right thing happens...
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.