Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8014343
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:54:17+00:00 2026-06-04T19:54:17+00:00

should I call super.xxxx() before my custom code or after when I override a

  • 0

should I call super.xxxx() before my custom code or after when I override a method?
Is there some skills to Identify?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T19:54:19+00:00Added an answer on June 4, 2026 at 7:54 pm

    The short answer: It Depends.

    The long answer:
    You need to understand what the implementation of the method in the parent class does.

    • There are cases when the super method does some “initialization” work required for the overridden method to function smoothly. In such cases, the super.myMethod() call should be the first line in the method.
    • In some other cases, the implementation of the method in the parent class could be responsible for some clean up (or some sort of finalization) operations. Thats when you would need to make the call to super the last line in your overridden implementation.
    • Then there are situations where the order doesn’t matter, but you must call the super method because the implementation in the base class performs some operation which are necessary; although the order of these operations doesn’t matter. Most of the Activity life cycle methods fall in this category. Which is why you must call though to super.onCreate() although you can do it at any point in your onCreate().
    • Finally, there are also cases where the call to the super method is not required. The base class has a default implementation which you may choose to use or ignore. You might also end up doing an if-else here: For instance, you might call through to the super implementation. If it returns a null, you might create a new object and return that instead.

    Is there some skills to Identify?

    • Read the method documentation and see if there is any mention of the order in which the super method must be called.
    • Go through the source code of the base class and see if you can figure out whether it does anything that necessitated calling it in a particular order.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

when overriding the loadView method in UIViewController, should one call [super loadView] in the
Say, if I don't call super.onPause in a override method from superclass Activity ,
What are the scenarios in which I should call finish() method on back button
I'm writing the spec for controller: it 'should call the method that performs the
I have some ctypes bindings, and for each body.New I should call body.Free. The
http://code.google.com/appengine/docs/python/tools/uploadingdata.html is not clearly understand. Where i should call the bulkloader.py or appcfg.py? Should
Trying to convert super(B, self).method() into a simple nice bubble() call. Did it ,
I thought that I should never call [super loadView] but something is confusing me.
If i implement my own version of awakeFromNib , should I call [super awakeFromNib]
I have seen some Apple examples that do call [super viewDidUnload]; and some that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.