Missing Context for method declaration


#1

[code]#import “BNRItem.h”

  • (NSString *)description ------------> error:missing context for method declaration
    {
    NSString *descriptionString =
    [[NSString alloc] initWithFormat:@"%@ (%@): Worth $%d, recorded on %@",
    itemName,
    serialNumber,
    valueInDollars,
    dateCreated];

    return descriptionString;
    }[/code]

what happened ??

also am i supposed to have the rest of the code on here if I’m overriding a description method??


#2

You forgot to put it inside the implementation block:

#import "BNRItem.h"

@implementation ...
...
- (NSString *)description
{
    NSString *descriptionString =
    [[NSString alloc] initWithFormat:@"%@ (%@): Worth $%d, recorded on %@",
     itemName,
     serialNumber,
     valueInDollars,
     dateCreated];
    
    return descriptionString;
}
...
@end

I don’t understand the question. Try to be more specific please.


#3

thanks i figured it out that question was worded weird sorry