12
I came from C++/Java world where it's quite obvious how to create private members. However, I saw several ways to do this in Objective C and I would like to hear cons and pros
1) Declare them as @private in .h file
@interface MyClass : NSObject
{
@private
int someMember;
}
@end
2) Declare them in interface inside .m files
@interface MyClass() {
int someMember;
}
@end
@implementation MyClass
@end
3) Declare them in implementation
@implementation MyClass {
int someMember;
}
@end
What is the preferred method and why? Did I miss any other methods?