main.cpp and h file, realize the relationship between cpp file (transfer)

The relationship between the c language files [in-depth good text]
summary: write the declaration of each function, class declaration, structure declaration, variable declaration in the h file ( use extern int num, and then assign the value in the cpp file; otherwise, don’t define Variable values ​​are prone to re-definition errors ); define variable values ​​and function implementations in the implementation cpp file. In addition, you can actually implement cpp files without the include header file, but if there are functions nested functions in the implementation file, you need to consider the order of function implementation (for example, function A calls function B and function B is implemented after function A An error will be reported, and because all functions have been declared in advance after the include header file, there is no need to consider the order of these.)

Guess you like

Origin blog.csdn.net/weixin_43145941/article/details/108830068