Multi-file organization of C + + programs

Source: Internet
Author: User

When the program size becomes larger, a program is organized with multiple files to facilitate the organization of production. This way, you do not have to compile all the code every time, but only once. After the compilation of the resulting target file to save, and later when necessary to transfer it directly to the program's target file to connect.

A common practice in C + + is to separate out a header file. The benefits of proper use of header files include: Support for local compilation of code, especially for classes and member functions, to ensure that all files use the same declaration for a given entity, and that only the header file needs to be updated when the declaration needs to be modified. When using a header file, the header file is used only for declarations, not definitions, and header files generally contain declarations that support the class definitions and variables and functions required to compile separately. In addition, some const objects are defined in the header file. The member function definition for a class has only one exception in the header file, which is that the built-in (inline) member function needs to be defined in the header file.

Examples can be referred to: http://www.cnblogs.com/jiu0821/p/4395738.html

Multi-file organization of C + + programs

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.