• 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: Inheritance question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Inheritance question


  • Subject: Re: Inheritance question
  • From: Simone Tellini <email@hidden>
  • Date: Fri, 17 Aug 2007 13:18:50 +0200


Il giorno 17/ago/07, alle ore 12:41, Daniel Angermeier ha scritto:

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 ?

because Objective-C resolves the method at runtime. The cast is useless.

Is there any other way to force the run time to use the super
implementation of that method ?

Perhaps you should ask this question on the Objective-C list.

IMHO, it would be best to rethink the design of the application instead, so that you don't need to do such a 'strange' thing, even if it were somehow possible.

--
Simone Tellini
http://www.tellini.org



_______________________________________________

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


References: 
 >Re: Inheritance question (From: "Daniel Angermeier" <email@hidden>)

  • Prev by Date: Re: Inheritance question
  • Next by Date: Re: Struct Data Types
  • Previous by thread: Re: Inheritance question
  • Next by thread: Re: Inheritance question
  • Index(es):
    • Date
    • Thread