Sorry for the total newb here. What's the right way to create
getters/setters for int's? Without the compiler warning about them?

I've been trying:

-(void)setSomeInt:(int)theInt
{
    someInt=theInt;
}

-(int)someInt
{
    return someInt;
}

Then calling it..
[myObj setSomeInt:1];

Usually I get two warnings:
"warning: assignment makes pointer from integer without cast"
"warning: return makes integer from pointer without cast"

>From those two warnings, I was thinking these updates do the trick:

-(void)setSomeInt:(int)theInt
{
    someInt=(int *)theInt;
}

-(int)someInt
{
    return (int)someInt;
}

Calling it:
[myObj setSomeInt:(int *)1];

Is this the correct way?
Thanks all..
_______________________________________________

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 arch...@mail-archive.com

Reply via email to