#import vs. @class

You #import or #include when there is a physical dependency. Otherwise, you use forward declarations (@class MONClassstruct MONStruct@protocol MONProtocol).

Here are some common examples of physical dependence:

  • Any C or C++ value (a pointer or reference is not a physical dependency). If you have a CGPoint as an ivar or property, the compiler will need to see the declaration of CGPoint.
  • Your superclass.
  • A method you use.

参考:http://stackoverflow.com/questions/322597/class-vs-import

posted @ 2016-03-04 18:01  Gabriel_Lee  阅读(152)  评论(0)    收藏  举报