• 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: obj-c: how do i call an instance method in my super's super?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: obj-c: how do i call an instance method in my super's super?


  • Subject: Re: obj-c: how do i call an instance method in my super's super?
  • From: Bill Bumgarner <email@hidden>
  • Date: Wed, 21 Sep 2005 19:26:51 -0700

On Sep 21, 2005, at 5:20 PM, Ken Victor wrote:
for the time being, i've put a "proxy" method in subClassOfBaseClass that simpl;y calls baseClass's foobar and i call this "proxy" method from foobar in subClassOfSubClassOfBaseClass. but it seems that there aught to be a more direct approach (without having to talk directly to the runtime code).

Remove the proxy and it'll "just work".

If the proxy was not a proxy, but a real method, then you really, *really*, would not want to to message super's super. The whole point of super's overriding the method is to provide custom functionality that very likely may completely override or extend the behavior of super's super's implementation.

If you subsequently bypass super's implementation, you are (a) breaking encapsulation and (b) asking for a world of hurt come debugging/support time.

In general, if you have a class design that requires direct invocation of a particular classes instance method to bypass any overrides, then there is something horribly wrong in the design of the classes!

b.bum

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >obj-c: how do i call an instance method in my super's super? (From: Ken Victor <email@hidden>)

  • Prev by Date: Re: Of input loops and games
  • Next by Date: Re: NSRoundRectBezelStyle still doesn't work with NSPopUpButton?
  • Previous by thread: Re: obj-c: how do i call an instance method in my super's super?
  • Next by thread: NSResponder subclass not getting -mouseDown
  • Index(es):
    • Date
    • Thread