(NSString *)description?


I’m reviewing the chapter to make sure I got the concepts right, and I noticed that when we’re overriding the description method on Asset.m we describe the return as (NSString *).

Later on, in the Employee header, there’s “- (void)addAssetsObject:(Asset *)a;”

What does the * mean? Why is it there?

And on the second example, what is “a”?

Can you help me understand this one?



- (NSString *)description

“Return our description as an NSString object, which is of type NSString*.”

// Return our description as a NSString object
- (NSString *)description
    NSString *it = [NSString stringWithFormat:@"...", ...];
    return it;

- (void)addAssetsObject:(Asset *)it

“Add an Asset object, which is of type Asset *; it is the local name by which you refer to that object inside the method.”

Declarations of the names of objects created from class interfaces must have “*” before the names.
For example:
NSString *name, MyMLCompiler *myCompiler, InformationTechnology *it, etc.

Declarations of all methods returning an object or taking objects as arguments must look like this:
{+, -} ( *)

For example:
- (NSString *)description;
- (NSMutableString *)mutableCopy;
- (String *)reverse:(NSString *)it;
+ (Foo *)makeFooWithName:(NSString *)name withHeart:(Heart *)heart withTemper:(unsigned long)temper;

Have fun with the review!


Awesome. Makes sense. Thanks.