#include using namespace std; class Document { public: Document ( void ) : docid ( 0 ) { } int get_docid ( void ); private: int docid; }; int Document::get_docid ( void ) { return docid; } int main ( void ) { try { Document mydoc1; throw mydoc1; //遵循1 } catch ( Document &d ) //遵循2 { cout << d.get_docid ( ) << endl; } return ( 0 ); }