• 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
When to call super
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

When to call super


  • Subject: When to call super
  • From: "McLaughlin, Michael P." <email@hidden>
  • Date: Tue, 12 Aug 2014 13:02:54 +0000
  • Thread-topic: When to call super

Is there a sure-fire way to know when it is necessary to call super in an override?

Sample code shows that calling super is necessary for methods such as

-(id)init


- (void)windowControllerDidLoadNib


but not for


(NSData *)dataOfType


(BOOL)readFromData


How can you know for sure?


This question occurred to me recently when I realized that my implementation of


(NSApplicationTerminateReply)applicationShouldTerminate


did not call super and I was wondering whether I should.  Currently, I just clean up and return NSTerminateNow.


Thanks for any reply.



—
Michael P. McLaughlin

_______________________________________________

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


  • Follow-Ups:
    • Re: When to call super
      • From: Sean McBride <email@hidden>
    • Re: When to call super
      • From: Roland King <email@hidden>
  • Prev by Date: NSMenu in NSTableView column
  • Next by Date: Re: When to call super
  • Previous by thread: Re: NSMenu in NSTableView column
  • Next by thread: Re: When to call super
  • Index(es):
    • Date
    • Thread