In Main I sent an argument message to an instance variable in the object myVar. Also in Main I created a variable called 'newValue'. I am trying to set the variable 'newValue' using a pointer to 'value' located in the myVar object.
I get the error here.
I am getting an error saying "Value undeclared"?
Here is MAIN
Here is the Class @interface
Here is the Class @implementation
Any help is always appreciated
I get the error here.
Code:
newValue = *value;
I am getting an error saying "Value undeclared"?
Here is MAIN
Code:
#import <Foundation/Foundation.h>
#import"varstore.h"
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
varstore * myVar = [[varstore alloc] init];
int newValue;
[myVar setValue:5];
NSLog(@"value = %i",[myVar value]);
newValue = *value;
NSLog(@"new Value = %i", newValue);
[myVar release];
[pool drain];
return 0;
}
Code:
#import <Foundation/Foundation.h>
@interface varstore : NSObject
{
int value;
}
@property int value;
-(void) setValue: (int) num;
@end
Code:
#import "varstore.h"
@implementation varstore
@synthesize value;
-(void) setValue: (int) num
{
value = num;
}
@end
Any help is always appreciated