Workaround to accomplish protected properties in Objective-C

前端 未结 4 1993
你的背包
你的背包 2021-01-30 04:35

I\'ve been trying to find a workaround to declare @protected properties in Objective-C so only subclasses in the hierarchy can access them (read only, not write). I read that th

4条回答
  •  青春惊慌失措
    2021-01-30 05:02

    For simple "properties" just use ivar instead. That's as good as properties for all practical purposes.

    Moreover, the default is already protected.

提交回复
热议问题