Files Classes Functions Hierarchy
00001 00002 #include <iostream> 00003 using namespace std; 00004 00005 #include <visitbase.h> 00006 #include <visitdataA.h> 00007 #include <visitdataB.h> 00008 #include <visitprint.h> 00009 #include <visitdataC.h> 00010 00011 00012 void test03() 00013 { 00014 visitbase *pA = new visitdataA(13); 00015 visitbase *pB = new visitdataB("cat"); 00016 00017 visitbase *f = new visitprint(); 00018 00019 cout << "Try A(print)" << endl; 00020 (*pA)(f); 00021 cout << "Now try the reverse print(A)" << endl; 00022 (*f)(pA); 00023 00024 cout << "Try B(print)" << endl; 00025 (*pB)(f); 00026 cout << "Now try the reverse print(B)" << endl; 00027 (*f)(pB); 00028 00029 cout << endl; 00030 cout << "Now a new data member C is implemented" << endl; 00031 cout << "It has to work with the exiting print operator" << endl; 00032 00033 visitbase *pC = new visitdataC(1,3); 00034 cout << "Try matching a print and a C with print(C)" << endl; 00035 (*f)(pC); 00036 00037 } 00038 00039 00040 int main(int argc, char** argv) 00041 { 00042 test03(); 00043 00044 00045 return 0; 00046 } 00047
1.5.8