#include, #import, what's the difference between @class?

Source: Internet
Author: User

#include and #import have the same effect, except that #import ensures that header files are imported only once, without causing duplicate imports. #import能把头文件的所有信息都获取到, contains variables and methods for this class. And @class just tells the compiler that the name that is declared later is the name of the class, and how these classes are defined is completely unknown, so even if you use @class in the header file, you need to import the header file in the Declaration file. M.

Note: @class are used in order to prevent the header files from being imported into each other (cross-import);

#include, #import, what's the difference between @class?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.