The usual practice when writing C++ applications is to put the class declarations in a header file, with .h extension, and the function definitions in a source file, with .cpp extension.

The header file (.h) contains function prototypes, so another programmer can see what methods the class responds to, without having to worry about how the methods are implemented.

Sponsored Links

The source file (.cpp) contains the actual function definitions , placing the detailed code in a location isolated from the declarations in the header.

The cpp file has a #included statement that refers to the corresponding .h file.