Skip to content

Instantly share code, notes, and snippets.

@toulouse
Created October 5, 2013 02:47
Show Gist options
  • Save toulouse/6836071 to your computer and use it in GitHub Desktop.
Save toulouse/6836071 to your computer and use it in GitHub Desktop.
That's because you're doing it wrong
@class X
@interface Y : NSObject
@property (nonatomic, assign) int z;
- (int)times:(int)other;
- (int)timesX:(X *)xObject;
@end
@implementation Y
- (int)times:(X *)xObject
{
return self.z * xObject.zzz
}
@end
@interface X : NSObject
@property (nonatomic, strong) NSString *name;
@property (nonatomic, assign) int zzz;
@end;
int main()
{
std::cout << "hello" << std:endl;
X *x = [[X alloc] init];
x.zzz = 3; // alternatively, x->_zzz should work too I think, but that's an ivar access
Y *y = [[Y alloc] init];
// ... etc
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment