Objective-C – Private vs Protected vs Public

The usual trick is to create a class extension inside the .m file and put your private/protected property there instead of in the header.

//Person.m

@interface Person()

@property float height

@end

this hides the ‘height’ property

Another trick is if you want to create a readonly property is to declare it in the header
as

@property(readonly) int myproperty

but in the class extension as readwrite which allows your .m to modify the value using the getter/setter

@property(readwrite) int myproperty

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)