Whats wrong with this code? Objective C

Louis Vidal

I can't seem to get this to work, I want this to display (The value of myXYPoint is,2,4) Here's my code. I keep getting this in my output area (lldb). This is from the exercise in the book programming in objective c by stephen g kochan, pg50 question 7. I tried comparing this with answers but still haven't found the problem. I also get this at 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 could also be [XYPoint *myXYPoint = [XYPoint new]

    // Set coordinate to 2,4
    [myXYPoint setAbscissa: 2];
    [myXYPoint setOrdinate: 4];
    //setting the coordinates

    // Display the coordinate
    NSLog (@"The value of myXYPoint is: %i,%i", [myXYPoint abscissa], [myXYPoint ordinate]);
    //this is to display the coordinates


}
return 0;

}

Louis Vidal

i fixed this by clicking on the stop button on the top left in Xcode and than running it and it worked,i just had to stop running the application first. thanks for helping so fast though. Stupid mistake, sorry.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related