Re: Inheritance question
Re: Inheritance question
- Subject: Re: Inheritance question
- From: MacDeveloper <email@hidden>
- Date: Fri, 17 Aug 2007 16:41:03 +0530
I dont think this really works
[[[myClassInstance] super] theMethod]
you can't get super like this
Regards,
Mc Larry
On 17-Aug-07, at 4:32 PM, Tony Wroblewski wrote:
It doesn't work because you are still sending the message to your
object, even if you cast it. It doesn't work the same as C++, when
you can do virtual methods.
Wouldn't [[[myClassInstance] super] theMethod] work, although its
incredibly ugly
Tony
On 17 Aug 2007, at 11:41, Daniel Angermeier wrote:
In the context of MyClass:
[(MySuperClass *)self theMethod];
However, this call does not invoke MySuperClass's implementation but
that of MyClass.
How can force it to use the method in MySuperClass ?
[super theMethod];
Ok, this would work for that particular case, but what if I have an
instance of MyClass and want to call a super method on it.
[(MySuperClass *)myClassInstance theMethod];
why does this casting approach at compile time not work ?
Is there any other way to force the run time to use the super
implementation of that method ?
Thanks,
Daniel
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
40mac.com
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
40gmail.com
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden