extern "C" { #include #include #include #include "trace.hpp" } #ifdef _OBTRACE_ON #include "obtrace.hpp" #endif #ifdef _OBTRACE_ON class XClass : private OBTRACE #else class XClass #endif { public: XClass() { value=0; } XClass(int i) { value=i;} #ifdef _OBTRACE_ON // method ReportAll --------------------------------------- static void ReportAll() { OBTRACE::ReportAll(stdout,"XClass"); }//end ReportAll // method ReportCount -------------------------------------- static void ReportCount() { OBTRACE::ReportCount(stdout,"XClass"); }//end ReportCount #endif // _OBTRACE_ON protected: int value; };//end class XClass #ifdef _OBTRACE_ON class YClass : private OBTRACE #else class YClass #endif { public: YClass() { string[0]='\0'; } YClass(char* p) { strcpy(string,p);} #ifdef _OBTRACE_ON // method ReportAll --------------------------------------- static void ReportAll() { OBTRACE::ReportAll(stdout,"YClass"); }//end ReportAll // method ReportCount -------------------------------------- static void ReportCount() { OBTRACE::ReportCount(stdout,"YClass"); }//end ReportCount #endif // _OBTRACE_ON protected: char string[10]; };//end class YClass #ifdef _OBTRACE_ON char* OBTRACE::init=NULL; char* OBTRACE::init=NULL; #endif XClass ox1(2); YClass oy1("hello"); // functio doit1 ------------------------------------------------- int doit1() { TRACE(doit1) XClass* ox2 = new XClass(12); //delete ox2; RETURN1(1) }//end doit1 // function doit2 ------------------------------------------------ void doit2() { TRACE(doit2) XClass ox3(3); XClass* ox4 = new XClass(0); doit1(); //delete ox4; YClass* oy2 = new YClass("by"); #ifdef _OBTRACE_ON YClass::ReportCount(); #endif //delete oy2; RETURN }//end doit2 #ifdef _OBTRACE_ON void Report() { XClass::ReportAll(); YClass::ReportAll(); } #endif // function main ----------------------------------------------- int main() { TRACE(main) #ifdef _OBTRACE_ON atexit(Report); #endif doit2(); RETURN1(0) }//end main