You #import
or #include
when there is a physical dependency. Otherwise, you use forward declarations (@class MONClass
, struct MONStruct
, @protocol MONProtocol
).
Here are some common examples of physical dependence:
CGPoint
as an ivar or property, the compiler will need to see the declaration of CGPoint
.参考:http://stackoverflow.com/questions/322597/class-vs-import
原文:http://www.cnblogs.com/drbbq/p/5242965.html