Skip to content

Instantly share code, notes, and snippets.

@hfossli
Last active December 31, 2015 20:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hfossli/8041396 to your computer and use it in GitHub Desktop.
Save hfossli/8041396 to your computer and use it in GitHub Desktop.
Private, protected and public properties in objective-c
@interface DataObject : NSObject
// public properties
@end
#import "DataObject.h"
#import "DataObjectSubclass.h"
@interface DataObject ()
// private properties
// + you must redclare all properties you declared in DataObjectSubclass.h
@end
@implemenation
// code
@end
#import "DataObject.h"
@interface DataObject (SubclassEyesOnly)
// protected properties
@end
#import "DataObject.h"
@interface ImageObject : DataObject
// public properties
@end
#import "DataObject.h"
#import "DataObjectSubclass.h"
@interface DataObject ()
// private properties
@end
@implemenation
// code
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment