标签:image style return oid nbsp clu \n inf png
1 #include <iostream> 2 #include<typeinfo> 3 #include<vector> 4 5 using namespace std; 6 7 class Base{ 8 public: 9 virtual void fun(){cout << "Base::fun\n";} 10 }; 11 class Derived : public Base{ 12 public: 13 void fun(int i){cout << "Derived the i = " << i << endl;} 14 }; 15 class Sunzi : public Derived{ 16 public: 17 void fun(){cout << "in Sunzi\n";} 18 }; 19 20 int main() 21 { 22 Derived de; 23 de.fun(1); 24 //de.fun(); //error 25 Sunzi sun; 26 sun.fun(); 27 Base *ba = &sun; 28 ba->fun(); 29 return 0; 30 }
标签:image style return oid nbsp clu \n inf png
原文地址:https://www.cnblogs.com/CreatorKou/p/9056124.html