• 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
Re: ObjC Method naming
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ObjC Method naming


  • Subject: Re: ObjC Method naming
  • From: David Remahl <email@hidden>
  • Date: Mon, 28 May 2001 21:11:05 +0200

I have a silly question about the style convention used in Objective C
code. Take this example from page 56 of the ObjC reference.

[myRect setWidth:10.0 height:15.0];

Does this mean there is a method called set with two parameters width and
height? Wouldn't that be represented like this:

[myRect set Width:10.0 height:15.0];

Or does it mean there a method called setWidth with two parameters, a
nameless one(default?) and height.

I am coming from C/Java background so all these brackets and colons are
throwing me off a lot. ;-)

You can see it as you are passing two values along with the message (term for the [-bracket thingy ;). One is to be used as the value for the new width of the rectangle, and the other one decides the new height. it is a bit messy in the beginning, but once you get the hang of it, it is very intuitive, and the message prototypes are easier to remember and read, since you do not have to have the full header definition in you mind.

/ david


References: 
 >ObjC Method naming (From: Pedrum Mohageri <email@hidden>)

  • Prev by Date: Re: Serious Questions
  • Next by Date: Re: Two questions
  • Previous by thread: ObjC Method naming
  • Next by thread: Re: ObjC Method naming
  • Index(es):
    • Date
    • Thread