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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:28:03+00:00 2026-05-24T23:28:03+00:00

I am learning Objective C and noticed this funky quirk while reading up on

  • 0

I am learning Objective C and noticed this funky quirk while reading up on methods.

Like Java and C++, Obj.C can take in multiple parameters, which is fine, however it states that objective C methods can have multiple names which does not seem to register to well with me.

For instance:

-(NSArray *)shipsAtPoint:(CGPoint)bombLocation withDamage:(BOOL)damaged;

In the above example, there are two parameters, bombLocation (return type CGPoint) and damaged (return type BOOL) and alongside the method name seems to be split as shipsatpoint:withDamage

I don’t understand what’s up with this…
What does it signify when it states that a method can have multiple names?
Is this applicable only for methods that require multiple parameters? Alternately, say I want to name my method with a single name but provide it with multiple parameters, is that possible or I must provide it with multiple names each of which correspond to a parameter? If yes, then why?

Thanks for jumping in with my confusion!!! 🙂

  • 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-24T23:28:04+00:00Added an answer on May 24, 2026 at 11:28 pm

    The reason is to make it easier to understand.

    With your example, the method would be something like this in C++:

     int shipsAtPointWithDamage (CGPoint bomb, BOOL damage)  //I don't really know C++ 
    

    OK, so the first parameter is the ship’s point, and the damage is the second. It’s easy enough to figure out, but that’s the thing, you have to FIGURE it out, you have to look at the method to try and figure out what each thing is.

    In Objective-C you have

    -(NSArray *)shipsAtPoint:(CGPoint)bombLocation withDamage:(BOOL)damaged;

    Each parameter is clearly defined, the first is the ship’s point, the second is damage. It reads like a sentence, whereas with C++ (and almost every other language) it doesn’t.

    If you want a method to have multiple parameters in Obj-C you have to write it this way:

    -(returnType)paraOne:(type*)name paraTwo:(type*)name

    It’s something that just takes getting used to, every language is different. Once you get used to the way Objective-C does things, you’ll think it’s absolutely fantastic.

    EDIT: and as filipe pointed out, because the method as multiple parameters it doesn’t mean it has multiple names, in the example I gave above, the method name would be paraOne:paraTwo, NOT paraOne:

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

Sidebar

Related Questions

Still learning Objective-C / iPhone SDK here. I think I know why this wasn't
I'm learning objective-C and Cocoa and have come across this statement: The Cocoa frameworks
I'm learning Objective-C at the moment and have come across optional methods in Protocols.
I'm interested in learning Objective C for iPhone development. This is a topic which
I am learning objective-C and for the life of me can't figure out why
I am just learning objective-c but can't figure out whats wrong with my code
I'm in my second day of learning Objective-C, Cocoa and IB. This is probably
I have just started learning Objective-C, I am reading Programming in Objective-C 3rd Edition
I'm learning Objective-C, so please, be nice. :-) While learning how to connect Objective-C
While learning objective-c, I've made a basic mac shopping list app with 3 interface

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.