Hide instance variable from header file in Objective C

后端 未结 10 1043
梦如初夏
梦如初夏 2020-12-30 14:35

I came across a library written in Objective C (I only have the header file and the .a binary). In the header file, it is like this:

@interface MyClass : MyS         


        
10条回答
  •  悲&欢浪女
    2020-12-30 14:40

    No you can't. But you can do this if you're not using @property:

    .h

    @interface X : Y {
      struct X_Impl* impl;
    }
    -(int)getValue;
    @end
    

    .m

    struct X_Impl {
      int value;
    };
    ...
    @implementation X
    -(void)getValue {
      return impl->value * impl->value;
    }
    @end
    

提交回复
热议问题