What is the difference between @class and #import

后端 未结 8 1733
再見小時候
再見小時候 2020-12-05 03:56

When I compile with the following code there are no errors:

@class RootViewController;
//#import \"RootViewController.h\"

When I compile wi

8条回答
  •  忘掉有多难
    2020-12-05 04:06

    @class means that the definition of the class RootViewController is not yet declared, but will be defined at run time. I believe it is like declaring an extern class in c++.

    #import is equivalent to #include.

    by the error message i could guess you just made a mistake somewhere inside RootViewController.h, such as a forgotten ; or something like that

提交回复
热议问题