Get integer value from another class

后端 未结 3 584
余生分开走
余生分开走 2020-12-22 04:41

I know i have done this before, but I just cant remember how to do it.

I have a integer, that i want to be able to change in another class of mine.

how do i

3条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-22 04:52

    You create getter and setter methods (or a property with synthesized accessors) in the class with the integer, give the other class a reference to some instance of the first class, and have it use those accessors to get and set the integer.

提交回复
热议问题