3.15 MULTI FILE PROGRAMS

Small programs are written in one file. When we write large programs, it becomes very inconvenient to use a single file. The solution is multi file programs. Here a big application program is split in many files. The splitting is normally logical. The constants and functions related to specific areas like input, output, graphics, etc. are put in specific files. These files are given extension “.h”. These files are included in the main program using #include pre-processor directive. The pre-compiled header files supplied by the compiler are specified by angular bracket, for example, #include <iostream.h>. We use double quotes, that is, #include “myfile.h” for files which we have created.

We said that splitting of files ...

Get Object Oriented Programming with C++, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.