Pointer Values
caveman_uk:
Actually, this autorelease class I'm attempting to create, "just for fun" is in straight Objective-C, not using the Foundation, so my comment early about an NSArray was an error, because that would be unavailable and defeat the purpose of my pointer question. Sorry about that.
robbieduncan:
I checked the size of
id and
int for my platform with the
sizeof(id) and
sizeof(int). Both return four bytes.
I tried your
address pointer concept above. Yes, I did get a couple of warnings about these assignments. But, it all worked out below!
Code:
id idpointer1;
id idpointer2;
id idpointer3;
int *intpointer;
idpointer1 = [[ClassOne alloc] init];
intpointer = idpointer1;
idpointer3 = intpointer;
[idpointer3 testMethod]; //The test method was called!
Thanks for the helps guys. Cool, I'm pretty stoked to know this! Off hand, is there anyway to remove these warnings by writing the code some other way? I've read that it is better not to write code with warnings.
Yes, these may be basic questions, but everyone has to ask them atleast once in their programming career.