Hello everyone!
I'm having a problem using a property for one of my custom class
objects.
I have a class like this:
INTERFACE (MyObject.h):
-----------------------------------
typedef struct {
float x;
float y;
} Vector2D;
@interface myObject : NSObject {
Vector2D _position;
}
@property Vector2D position;
@end
IMPLEMENTATION (MyObject.m):
---------------------------------------------
@implementation myObject
@synthesize position=_position;
- (id)init
{
if ((self=[super init]) != nil) {
_position.x = 0.0;
_position.y = 0.0;
}
return self;
}
@end
I tried to modify the "position" property in another file after
creating an object but I get this error:
obj.position.x += 1.0;
(x error: invalid lvalue in assignment)
I can assign the value without a problem:
float x = obj.position.x;
x += 1.0;
But then this is also a no-no:
obj.position.x = x;
Anyone have any ideas as to why the first assignment gives an error?
Thanks for any and all help.
- Don
_______________________________________________
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [EMAIL PROTECTED]