Exceptional C++ by Herb Sutter
I highly recommend the chapter on the Pimpl Idiom, use it all the time.
eg.
header file
Class BlahImp;
Class Blah
{
public:
void a();
private:
BlahImp *m_imp;
};
cpp file
// ctor and dtor of Blah new and delete m_imp
class BlahImp
{
public:
void a()
{
// private implementation of a() that stops other types and classes being exposed
}
};
void Blah::a()
{
m_imp->a();
}
Contents: Exceptional C++ contains 47 Items organized into eight major sections:
- Generic programming and the C++ standard library.
- Exception safety issues and
techniques.
- Class design and inheritance
- Compiler firewalls and the Pimpl Idiom.
- Name lookup, namespaces, and the
Interface Principle.
- Memory management.
- Traps, pitfalls, and anti-idioms.
- Miscellaneous topics.