Created
May 16, 2016 19:39
-
-
Save robertmryan/6c59c1fc44887b270c38758c6960dcae to your computer and use it in GitHub Desktop.
Triangle example for http://stackoverflow.com/questions/37261266/objects-in-objective-c-how-to-identify
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface Triangle : NSObject | |
@property (nonatomic) double sideALength; | |
@property (nonatomic) double sideBLength; | |
@property (nonatomic) double height; | |
@property (nonatomic, readonly) double area; | |
@end | |
@implementation Triangle | |
- (double)area { | |
// do your calculation here | |
return calculatedValue; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note, there is no asterisk next to the
double
properties, asdouble
is a fundamental data type, not an object. But if you then use theTriangle
class, that instance is an object, so you'd use an asterisk there, e.g.: