标签:generate 逻辑 output img png space 继承 延迟 重要
1 #include <iostream> 2 #include <string> 3 4 using namespace std; 5 6 class CDataParse 7 { 8 public: 9 virtual void ReadData() = 0; 10 virtual void ProcessData() = 0; 11 virtual void WriteData() = 0; 12 13 virtual void ParseDataAndGenerateOutPut() 14 { 15 ReadData(); 16 ProcessData(); 17 WriteData(); 18 } 19 20 }; 21 22 class CSVDataParse: public CDataParse 23 { 24 public: 25 void ReadData() 26 { 27 cout<< "CSVDataParse Reading......"<< endl; 28 } 29 30 void ProcessData() 31 { 32 cout<< "CSVDataParse ProcessData......"<< endl; 33 } 34 35 void WriteData() 36 { 37 cout<< "CSVDataParse WriteDataing......"<< endl; 38 } 39 40 void Process() 41 { 42 ParseDataAndGenerateOutPut(); 43 } 44 }; 45 46 47 int main(int argc, char* argv[]) 48 { 49 CSVDataParse* cSvDataParse = new CSVDataParse(); 50 51 cSvDataParse->Process(); 52 53 cout<< endl; 54 55 return 0; 56 } 57 //////////////////////// 58 [root@ ~/learn_code/design_pattern/8_template]$ ./template 59 CSVDataParse Reading...... 60 CSVDataParse ProcessData...... 61 CSVDataParse WriteDataing......
标签:generate 逻辑 output img png space 继承 延迟 重要
原文地址:http://www.cnblogs.com/070412-zwc/p/6814995.html