????2. ????????????????г?????????????? “impl” ????
????2.1.??? “impl” ?????д???????????????????????
????impl ???????????? ?????г???????????????impl ?? ????????????г??????????????impl* ??????????£?
????// file old.h
????class old {
????// ???к???????
????// public and protected members
????private:
????// ??г???? ????????????????????仯?????????????
????// ?????????????old.h????????????±???
????// private members; whenever these change??
????// all client code must be recompiled
????};
??????д????????
????// file old.h
????class old {
????// ???к???????
????// public and protected members
????private:
????class oldImpl* pimpl_;
????//  ?滻???????????г??????????impl?????????????????????????????
????//  ????д???????????????????????????????????
????//  ????????????д
????//  a pointer to a forward-declared class
????};
????// file old.cpp
????struct oldImpl {
????// ?????????????????????? ????仯?? ?????????????????±???
????// private members; fully hidden?? can be
????// changed at will without recompiling clients
????};
???????????????????У? ?????????????д?????????£???????????????????????????????????????£?

???????impl?????????????
// ??? file and cx ???麯??.
#include "file.h"
#include "db.h"
class cx;
class error??
class old : public file?? private db {
public:
old( const cx& );
db  get_db( int?? char* );
cx  get_cx( int?? cx );
cx& fun1( db );
error  fun2( error );
virtual std::ostream& print( std::ostream& ) const;
private:
class oldimpl* pimpl;
//???????????????
};
inline std::ostream& operator<<( std::ostream& os??const old& old_val )
{ return old_val.print(os); }
//implementation file old.cpp
class oldimpl{
std::list<cx> cx_list_;
deduce        dudece_d_;
};
????3. ??????????????????
??????????????????????????????в??????? old class ???????????????? class old ???file ?? db ?? ???file????м?У????db ????м??
?????????file ??????? ???file ?????麯???? old ???????????? ??????????????裬 ???file ?? cx ???麯??????м??db ????????! ???????????????
??????? ??м??—???????????????????????????????Java??final??????????????????????????????????? ?????????м???????????? ?????e???????????db?????????? ????????
??????”db.h”????????? ??db ????????????impl???У??????????????????
// ??? file and cx ???麯??.
#include "file.h"
class cx;
class error;
class db;
class old : public file {
public:
old( const cx& );
db  get_db( int?? char* );
cx   get_cx( int?? cx );
cx& fun1( db );
error  fun2( error );
virtual std::ostream& print( std::ostream& ) const;
private:
class oldimpl* pimpl;
//???????????????
};
inline std::ostream& operator<<( std::ostream& os??const old& old_val )
{ return old_val.print(os); }
//implementation file old.cpp
class oldimpl{
std::list<cx> cx_list_;
deduce        dudece_d_;
};
????С????£?
???????????????????????????????????????
????1. ??????????#include??????? ?????????? (forward declared )
????2. ????????????????г?????????????? “impl” ????
????3. ??????????????????
????????????????????????? ??????????????????????ο??????????????????????????????????????? ??????????????????????н?? ??????????????????impl???????????????£??????…