June 2025
Intermediate to advanced
1093 pages
33h 24m
English
It is beneficial for the program's clarity if you separate definition and implementation. This even goes so far that you should put the structure definition in a header and the definition in an implementing *.cpp file (see Figure 12.2).
Figure 12.2 Splitting a class into the header and implementation.
If you need Person in multiple parts of the program, use #include "person.hpp" there to make the data type known to the compiler.
Just in case you need to include person.hpp multiple times through various includes, the surrounding lines are there:
#ifndef PERSON_HPP#define PERSON_HPP// … actual ...
Read now
Unlock full access