Re: ObjC Method naming
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