Original Post
I am reading Stephan K. book "Programming in Objective-C" and I am stuck on a exercise question. This is actually only the second chapter of this book but I can not find out what I am doing wrong. (straight from the book) The exercise calls for defining a class called XYPoint that will hold a Cartesian coordinate (x,y), where x and y are integers. Define methods to individually set the x and y coordinates of a point and retrieve their values. Write and Objective-C program to implement your new class and test it. Heres the code, I used his work for most of my reference. //Program to access instance variales - cont'd #import //----Interface Section---- @interface XYPoint: NSObject { int xAxis; int yAxis; } -(void) print; -(void) setxAxis: (int) x; -(void) setyAxis: (int) y; -(int) xAxis; -(int) yAxis; @end //----Implementation Section---- @implementation XYPoint -(void) print { NSLog (@"%i,%i", xAxis, yAxis); } -(void) setxAxis: (int) x { xAxis = x; } -(void) setyAxis: (int) y { yAxis = y; } -(int) xAxis { return xAxis; } -(int) yAxis { return yAxis; } @end //----Program Section---- int main (int argc, char *argv[]) { NSAutoreleasePool * pool = [ [NSAutoreleasePool alloc] init]; XYPoint *myXYPoint = [[XYPoint alloc] init]; [myXYPoint setxAxis: 1]; [myXYPoint setyAxis: 3]; NSLog (@"The Point Lies at (%i,%i)", [myXYPoint xAxis], [myXYPoint yAxis]); [myXYPoint release]; [pool drain]; return 0; } Any ideas? I am sure you guys will see it A.S.A.P.