cpp files and header

Can someone simplify the type of information that should be stored in either of these. I think in cpp it is such things as functions that are stored, but i keep coming across different information stating different things
Hello kmce,

Beyond the usual header files that you include in a program header files usually contain information that is not program code, the definition of classes or structs. I us a header file that just has "#include <iostream>", "#include <string>" and others that would be used in any program. Another header file I call "proto.h" contains the proto types (of forward definitions) of functions.

.cpp files would contain the functions of a class or other functions that you would write. Generally you would put one or two functions in a .cpp file with the exception of the file for the functions of a class which would contain several functions needed for the class i.e., keep all of a classes functions in one place.

This may not be the best explaination.

Hope this helps,

Andy
Topic archived. No new replies allowed.