Effective C++: 55 Specific Ways to Improve Your Programs and Designs by Meyers Scott

Effective C++: 55 Specific Ways to Improve Your Programs and Designs by Meyers Scott

Author:Meyers, Scott [Meyers, Scott]
Language: eng
Format: mobi
Publisher: Addison-Wesley Professional
Published: 2008-05-11T16:00:00+00:00


Here, class Person can't be compiled without access to definitions for the classes the Person implementation uses, namely, string, Date, and Address. Such definitions are typically provided through #include directives, so in the file defining the Person class, you are likely to find something like this:

#include <string>

#include "date.h"

#include "address.h"

Unfortunately, this sets up a compilation dependency between the file defining Person and these header files. If any of these header files is changed, or if any of the header files they depend on changes, the file containing the Person class must be recompiled, as must any files that use Person. Such cascading compilation dependencies have caused many a project untold grief.

You might wonder why C++ insists on putting the implementation details of a class in the class definition. For example, why can't you define Person this way, specifying the implementation details of the class separately?



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.