标签:style blog color os io strong ar div cti
1 #include <iostream> 2 using namespace std; 3 4 class thebase { 5 public: 6 virtual void basePrint() { 7 cout << "the base class basePrint() function." << endl; 8 } 9 10 void basePrint2() { 11 cout << "the base class basePrint2() function." << endl; 12 } 13 14 }; 15 16 class thesub : public thebase{ 17 public: 18 void basePrint() { 19 cout << "i will call the parent function." << endl; 20 thebase::basePrint(); // 显式调用基类成员. 21 } 22 23 }; 24 25 int main(int argc, char* argv[]) 26 { 27 28 thesub mysub; 29 mysub.basePrint(); 30 31 return 0; 32 }
标签:style blog color os io strong ar div cti
原文地址:http://www.cnblogs.com/disemboltura/p/3944543.html