(6.6)--6.6Programswithmultiplefilestruc.pdf
《(6.6)--6.6Programswithmultiplefilestruc.pdf》由会员分享,可在线阅读,更多相关《(6.6)--6.6Programswithmultiplefilestruc.pdf(15页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、Programs with multiple file structuresPrograms with multiple file structures6.6When developing a software with complex functions,the thinking of modularization is often adopted to divide the software into multiple function modules,and then assign different modules to different people in charge,so th
2、at realize the cooperative development of a complex software by multiple people.Module1Module2Module nSoftwarePrograms with multiple file structures6.6When writing complex programs,it is often necessary to adopt the modularprogramming method with multiple file structure,which means,the functions and
3、variable definitions of the same functionality are placed in the same file,and thefunctions and variable definitions of different functionalities are placed in multiplefiles.Programs with multiple file structures6.6Advantages:1.Make the program structure clear,easy to manage and search;2.Theimplemen
4、tationofdifferentfunctionmodulesisdistributed in different files,which could avoid the problem thataccess conflict may occur when multiple people are modifying afile at the same time in the collaborative developing of aprogram.Programs with multiple file structures6.6 Definition of data type,such as
5、 structure,enumeration,etc.The declaration of user-defined function,usually we put the declaration of all functions defined in a source file in one corresponding header file.Symbolic constant definition and macro definition.In the multiple file structure of C+,users can customize their header file(w
6、ith file extension h),which usually contains the following parts:Header filePrograms with multiple file structures6.6If you want to use these user-defined data types,global variables,symbolic constants,inline functions and user-defined functions in a file,the only thing you need to do is to include
7、the header file in which they are included,without repeated definition and declaration at every time.In general,the header file only contains the declaration of the user-defined functions,not the definition.External declaration of global variables.Definition of inline functions.Include other necessa
8、ry header files.Programs with multiple file structures6.6Source file The definition of a user-defined function should be given in the source file(.cpp).Before calling these functions in other source files,we only need to include the header files in which the declaration of these functions are contai
9、ned.The definition of global variables should also be contained in the source file,and the external declaration of global variables should be contained in the header file.To use global variables in other source files,the only thing we need to do is to include the header file in which the external de
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 6.6 Programswithmultiplefilestruc
限制150内