#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 ); }