#import in objective C: Am I doing this wrong?

前端 未结 3 1947
孤独总比滥情好
孤独总比滥情好 2021-01-21 07:48

Sorry, couldn\'t find a more appropriate title.

In My code I have two classes which should know of each others existence. So I use an instance variable which points to t

3条回答
  •  长发绾君心
    2021-01-21 08:05

    In the header, use forward declaration:

    @class IRCConnection;
    
    @interface MainMenuController : NSViewController {    
        IRCConnection *ircConnection; // ok
    }
    

    In the source file (.m), do #import.

提交回复
热议问题