Re: Nested messages and void error
Re: Nested messages and void error
- Subject: Re: Nested messages and void error
- From: Enrique Zamudio <email@hidden>
- Date: Fri, 17 Aug 2001 13:33:33 -0500
- Organization: Nasoft
aStr = [[NSMutableString stringWithString: [aString string]]
appendString:
@"another string"];
+stringWithString: returns a string.
-appendString: returns void, so you can not assign it to anything.
You should do this:
aStr = [NSMutableString stringWithString: [aString string]];
[aStr appendString:@"another string"];
you can nest messages as long as they all return an object. the last one
must return something only if you're assigning it to a variable,
otherwise the last method can be void.
This is valid:
[[someString mutableCopy] appendString:@"another string"];
mutableCopy returns an object, which gets the message appendString:
which returns void.
eZL