tags:

views:

94

answers:

1

I am trying to write my first class in objective-c and i want to pass an NSString object as a parameter in a method of the class, however i get an error saying that "can not use an object as parameter to a method". So my question is how do you pass a string as a parameter to a method? here is my code tht i am trying to get to work:

#import <Foundation/Foundation.h>

@interface Car
{
    NSString *color;
    NSString *make;
    int year;
}    

- (void) print;
- (void) setColor: (NSString) c;
- (void) setMake: (NSString) m;
- (void) setYear: (int) y;


@end

@implementation Car

- (void) print
{
    NSLog(@"The $d Ford %@ is $@.", year, make, color);
}

- (void) setColor: (NSString) c
{
    color=c;
}

- (void) setMake: (NSString) m
{
    make=m;
}

- (void) setYear: (int) y
{
    year=y;
}


@end



int main (int argc, const char * argv[]) {
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

    Car *car= [Car new];

    [car setColor:@"blue"];
    [car setMake:@"Bronco"];
    [car setYear:1992]

    [car print];
    [car release];

    [pool drain];
    return 0;
}
+3  A: 
Tobi
that totally worked, thanks so much for your help i've been searching the web for an answer and you're the only one who has been able to answer me. so thanks a bunch
Joe