Objective C, Difference between defining private variables with @private and defining them with class extension?

StackOverflow https://stackoverflow.com/questions/17018985

  •  31-05-2022
  •  | 
  •  

문제

I wonder the difference between defining private variables in the .h file using the key word @private and defining them in the .m file using the class extension?

Thanks.

도움이 되었습니까?

해결책

iVar declared in the implementation are implicitly hidden (effectively private) and the visibility cannot be changed - @public, @protected and @private do not produce compiler errors (with the current Clang at least) but are ignored.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top