Objective-C : (private / public properties) making a property readonly for outside class calls and readwrite for self calls

后端 未结 4 910
野的像风
野的像风 2020-12-04 18:01

Would you know a way to make a property readonly for outside calls and readwrite for inside calls ?

I\'ve read times ago somthing that seemed like

In the .h

4条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-04 18:24

    In the .m, you shouldn't put @property again. I'm not sure what effect that has, though. Did you mean to use @synthesize?

    Note that theDate will be read/write inside the class implementation anyway, regardless of being readonly to the outside world.

提交回复
热议问题