Expose a private Objective-C method or property to subclasses

后端 未结 7 1368
栀梦
栀梦 2020-12-05 06:43

According to some official talk, a class in Objective-C should only expose public methods and properties in its header:

@interface MyClass : NSObject

@prope         


        
7条回答
  •  被撕碎了的回忆
    2020-12-05 07:23

    That's because there's not even a real distinction between private and public. While the compiler may warn you about an interface missing a certain method or instance variable, your program will still work.

提交回复
热议问题