The C ++ language starts from writing --> executing the entire process. Generally, the following steps are required to develop a C ++ program:
1. Write code,
2. compiler compilation, compile
3. Connect the connector.
4. Execute.
The C ++ language supports multi-file engineering. Compilation and connection are required.
For example, if you want to build an airplane, you need an engine, wing, body, tail, and landing gear. You can hand over these parts to a dedicated vendor for production. This is the compilation process. You only need to assemble so many parts. This is the connection process.
The compiler (such as Vc) is the factory for processing parts. The source code of the compiler will become the target file, that is, the part. The. OBJ file is generated by VC.
A connector (such as a link under VC) is an assembly factory that assembles all the parts into what you need.
Now that we understand the compiler and connector, let's look at the header file. h and the role of implementing file. cpp.
Take the plane for example. The fuselage and the wing must be connected, but how can they be connected? Only the wing is made, and only the fuselage is made. Then, as an assembly factory, you will provide them with an aircraft interface design drawing, which details the connection between the wing and the fuselage, but does not describe how the wing and the fuselage should be made. After the parts factory obtained the structural drawings, they knew that the wing was originally placed in this place of the fuselage. Well, they stipulated that they should be connected with rivets (for example. Okay, I see. I can do it. As a wing manufacturer, I don't have to worry about how the fuselage is made. I only care about the production of the wing and the interface with the fuselage. Switch to the C ++ side. This is the. h file used to describe the interface design, that is, the header file. The specific implementation of the wing is equivalent to the. cpp file.
Therefore, you only need to apply the header file in the program, that is, you only need to know the interface design. After you have designed the parts based on the Interface Design Drawing and handed them to the assembly factory, the Assembly Factory (that is, the connector) will compile all the parts (the compiler. the. OBJ) connection, so that the plane can soar in the sky.
From: <a href = "http://wenwen.soso.com/z/q173479633.htm"/>