Re: Objetive-C sintax
Re: Objetive-C sintax
- Subject: Re: Objetive-C sintax
- From: "Jordan Krushen" <email@hidden>
- Date: Sun, 2 Apr 2006 09:56:43 -0700
On 4/2/06, JuanC <email@hidden> wrote:
> Could anyone of the gurus of this mailing list explain my this line
> of code:
> NSString *stringFinal = [NSString stringWithFormat:@"%@ tiene %d
> letras", [gEntradaDeTexto stringValue], [stringDeEntrada length]];
> More expecific, I don't understan why need introduce the class name
> in the first part of de method call. I define a pointer to a variable
> of NSString type and named -stringFinal- but when I make the method
> call I need use NSString in the begining of the call, why?
A great many classes have methods that return (NSString *). The type
alone is not enough to infer the receiver of the messsage. In this
case, you want to create your own string, so you're sending the
NSString class a message, but you could also be calling something like
-[NSWindow title] which would also return (NSString *).
J.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden