Although you may choose to put complete class definitions into included files, most seasoned C++ programmers divide class definitions into two files: a special header file and a source file that contains function definitions. As you learn later in this chapter, such division enables you to divide large programs into multiple, independently compilable files.
The general rule is that header files should contain only declarations; they should not contain any storage-allocating definitions.
Thus, header files should contain only member
function prototypes, not
member function definitions. The actual definitions of the member
functions go in ordinary source-code files with cxx
extensions.
By convention, you always give header files an h
extension, for
header, rather than a cxx
extension.