Thanks for responding Seerex. I've been really confused about objective C as I am virtually a complete programming newbie. I've felt like giving up a few times so knowing I got that right is a big confidence booster for me

.

By the way, I have come across that way of writing the method before elsewhere but didn't have a clue what it ment until you mentioned it here in the way you did so thanks again! I've amended my code below to include it.

#import <Foundation/Foundation.h>

//---- @interface section ----

@interface Complex : NSObject

-(void) print; //display as a+bi

-(void) setReal:(double)a andImaginary:(double)b;

-(double) real;

-(double) imaginary;

@end

//----@implemetation section ----

@implementation Complex

{

double real;

double imaginary;

}

-(void)print

{

NSLog(@"The value of my complex is: %g+%gi", real, imaginary);

}

-(void) setReal:(double)a andImaginary:(double)b;

{

real = a;

imaginary = b;

}

-(double) real

{

return real;

}

-(double) imaginary

{

return imaginary;

}

@end

//---- program section ----

int main (int argc, const char * argv[])

{

@autoreleasepool {

Complex *myComplex = [[Complex alloc] init];

// Set real and imaginary

[myComplex setReal:5 andImaginary:10];

// Display code to test output

[myComplex print];

}

return 0;

}