xcode - Whats wrong with this code? Objective C -
i can't seem work, want display (the value of myxypoint is,2,4) here's code. keep getting in output area (lldb). exercise in book programming in objective c stephen g kochan, pg50 question 7. tried comparing answers still haven't found problem. @ line 14,(thread 1:breakpoint 1.1.2.1)
#import <foundation/foundation.h> //interface section @interface xypoint: nsobject -(void)setabscissa: (int) x; -(void)setordinate: (int) y; -(int)abscissa; -(int)ordinate; @end //--implementation section-- @implementation xypoint { int abscissa; int ordinate; } -(void)setabscissa:(int)x { abscissa=x; } -(void)setordinate:(int)y { ordinate=y; } -(int) abscissa; { return abscissa; } -(int) ordinate; { return ordinate; } @end //--program section-- int main(int argc, const char * argv[]) { @autoreleasepool { xypoint *myxypoint = [[xypoint alloc] init]; //it [xypoint *myxypoint = [xypoint new] // set coordinate 2,4 [myxypoint setabscissa: 2]; [myxypoint setordinate: 4]; //setting coordinates // display coordinate nslog (@"the value of myxypoint is: %i,%i", [myxypoint abscissa], [myxypoint ordinate]); //this display coordinates } return 0;
}
i fixed clicking on stop button on top left in xcode , running , worked,i had stop running application first. helping fast though. stupid mistake, sorry.
Comments
Post a Comment