Skip to content

Instantly share code, notes, and snippets.

@keicoder
Created January 7, 2014 03:02
Show Gist options
  • Select an option

  • Save keicoder/8294050 to your computer and use it in GitHub Desktop.

Select an option

Save keicoder/8294050 to your computer and use it in GitHub Desktop.
objective-c : 오브젝트와 클래스의 차이
distinction between an object and its class
//ice cream class
@interface IceCream : NSObject
@property (nonatomic, strong) NSString *flavor;
@property (nonatomic, assign) int scoops;
- (void)eatIt;
@end
// two instances of IceCream, one for you and one for me
// one class, IceCream, but there are two distinct objects.
// Your object has strawberry flavor, mine pistachio.
// one for you
IceCream *iceCreamForYou = [[IceCream alloc] init];
iceCreamForYou.flavor = @"Strawberry";
iceCreamForYou.scoops = 2;
// and one for me
IceCream *iceCreamForMe = [[IceCream alloc] init];
iceCreamForMe.flavor = @"Pistachio";
iceCreamForMe.scoops = 3;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment