Skip to main content

14.1) Why Should We Use Multiple Files?


Structuring a C++ program as a collection of functions helps to make it easier to write and easier for others (or yourself in the future) to read and understand.

A big program might consist of a great many functions, and there are advantages to distributing these functions across a number of different files:

  • Your efficiency is improved, because editing smaller files is quicker and easier, and because smaller files compile more quickly
  • Teamwork becomes easier, because people can work on different files simultaneously without causing problems
  • Opportunities for the reuse of functions in other programs are created