Thursday, November 8, 2012

Java vs. Objective-C

Java
Rectangle rect = Rectangle(someWidth, someHeight);
println(rect.getHeight());
boolean inside = rect.contains(x,y);

Objective-C
Rectangle *rect = [[Rectangle alloc] initWithWidth:someWidth andHeight:someHeight];
NSLog(@"%f", [rect height]);
BOOL inside = [rect containsPointWithX:x andY:y]

No comments: