????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???????????????锟�??????…