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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:50:01+00:00 2026-05-24T18:50:01+00:00

I started programming in C++. Because of this, I was taught early on that

  • 0

I started programming in C++. Because of this, I was taught early on that for each definition, there should be a declaration. With member functions, it is a requirement.

Now that I have started learning Objective-C, I was somewhat “shocked” to find out that you don’t need to pair them up. Obviously, if you don’t define a method, it will not be called. If you don’t declare a method, but define it, it will be called.

What’s the rationale for allowing this type of ad-hoc definitions? Since I’m biased by C++, I find it annoying to read other people’s code, as many times, the methods aren’t declared. It’s hard to get an overview of the class’s interface.

I found a couple of answers here: Objective c: method relation .h and .m. Unfortunately they’re not very conclusive.

  • 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-05-24T18:50:03+00:00Added an answer on May 24, 2026 at 6:50 pm

    Objective-C and other languages include meta-programming tooling that allows you to define methods dynamically, so you could declare a specific method and have something else define it in runtime, you can see a classic example of this feature on this question about how to implement method_missing like functionality on Objective-C.

    As for the other end, having methods implemented but not declared, there’s no definite way to define private methods on Objective-C and from time to time you want to define methods that are known only to your own classes and not for everyone else. So, you don’t declare the method in your .h file, but you implement it nonetheless at your .m file.

    The compiler will usually complain that you are using an undefined method, but you can either ignore this or declare these private methods at your .m file as a special category, it would look like this:

    @interface YourClass (PrivateMethods)
      - (void) somePrivateMethod;
    @end
    
    
    @implementation YourClass 
      - (void) somePrivateMethod { NSLog(@"Something!"); }
    @end
    

    Common patterns like Proxies (local or remote ones) usually rely on these meta-programming tooling to be available and they are quite common in languages like Java, Ruby, Python and Objective-C itself.

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

Sidebar

Related Questions

I have only recently started programming significantly, and being completely self-taught, I unfortunately don't
I am very new to this site and to programming. I started doing some
Since I've started programming in Java I have been wondering this (about a year
I started win32 programming for fun because I like complex things and I like
I've gone rounds with this ever since I started programming classic ASP 12 (or
Just getting started with Obj-C and iOS programming. I have some code that loads
Initially... I started programming in C. that was was 10 years back(college). The IDE
I just started programming in Xcode and I'm trying to write an iphone application.
My problem is perhaps pretty simple, but I just started programming in C#. My
Hey everyone, I'm basically new to programming. I've decided to try and get started

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.