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 177985
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T14:09:06+00:00 2026-05-11T14:09:06+00:00

In Objective C, if you are subclassing something, and are planning to override a

  • 0

In Objective C, if you are subclassing something, and are planning to override a method on the superclass, should you re-declare the superclass method in your subclass @interface?

For example, if you are subclassing UIViewController (e.g. MyViewController), and you are planning to override ‘viewDidLoad’ should you include that method in your MyViewController @interface declaration, or just implement it in MyViewController.m?

In examples I’ve come across, I’ve seen it done both ways (re-declaring the method in your subclass interface, or not re-declaring the method). There may not be any functional difference, but what is the best practice?

  • 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. 2026-05-11T14:09:07+00:00Added an answer on May 11, 2026 at 2:09 pm

    I often declare methods that I plan to override in either the public header or at least in a private category. The benefit to this is that you’ll get an incomplete class definition warning if you forget to actually override the method… which comes in handy from time to time.

    As for when to place it in the public header, that’s pretty subjective and probably up to you/your team’s coding styles. I usually only redeclare a method in the public header if I plan to radically change what the method is going to do or if I plan not to invoke the super class’s version of the method.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When subclassing in objective-c, how can I forward a call to the superclass in
Objective-C uses a sophisticated message-passing system when one object calls a method on another
The objective is to write a convenience method that return a ResultSet from a
[Objective-C] Do you still use Styrofoam balls to model your systems, where each ball
This is a general objective-c / iPhone question: If I have a large method,
Some programming languages have the feature of adding Categories to classes (for example Objective-C),
Objective-C has protocol which is the equivalence of interface in C#. Nevertheless C# enforces
in Objective-C if I need to add additional method to UIButton I can use
Objective: To prevent users from tampering any id (example: CustomerId, UserId, ProductId, etc) between
Objective-c is learn-able; Cocoa is learn-able; I find Interface Builder and its descendant Xcode

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.