Re: Super's Super?
Re: Super's Super?
- Subject: Re: Super's Super?
- From: Greg Titus <email@hidden>
- Date: Sat, 11 May 2002 21:40:32 -0700
Yep, I think Charles has the right idea. To be a little more concrete, I
think your classes should look like:
@implementation Grandparent
- realFunctionality
{
... /* your grandparents method */
}
- functionality
{
return [self realFunctionality];
}
@end
@implementation Parent
- functionality
{
... /* the override done by the parent */
}
@end
@implementation Child
- functionality
{
...
[self realFunctionality]; // gets at the grandparent's
implementation, since it isn't overridden...
}
@end
Hope this helps,
--Greg
On Saturday, May 11, 2002, at 09:00 PM, Charles Srstka wrote:
On Saturday, May 11, 2002, at 11:02 PM, Jeff LaMarche wrote:
On Saturday, May 11, 2002, at 08:47 PM, Charles Srstka wrote:
Maybe your class should be the subclass of the super-super class
instead of its current superclass?
Unfortunately, no. My first thought was exactly the same - perhaps the
design was wrong.. but in this case, the class is most definitely
appropriately a child of its superclass, there's just this one method
where the behavior needs to be totally different, but I still need the
functionality that the grandparent object (a non-concrete class that
is the root of my framework's heirarchy) provides. =(
Hmm, maybe you could make the grandparent's method look like this:
- (someType)someMethodWithArgument:(someOtherType)someArgument {
return [someOtherMethodWithArgument:someArgument];
}
The parent class could override this, and the grandchild class could
override that and call someOtherMethodWithArgument: .
Just a thought, don't know how good it is...
Charles
_______________________________________________
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.
_______________________________________________
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.