| class A
                                     {
                                     ……
                                     virtual int fun();
                                     void fun(int);
                                     void fun(double,double);
                                     ……
                                     };
                                     上述A类定义中的3个fun函数便是重载关系。
                                     | 
| #include<iostream>
                                         using namespace std;
                                         class A
                                         {
                                                 public:
                                                         virtual void fun1()
                                                         {
                                                                 cout<<"A::fun1()"<<endl;
                                                         }
                                                         virtual void fun2()
                                                         {
                                                                 cout<<"A::fun2()"<<endl;
                                                         }
                                         };
                                         class B:public A
                                         {
                                                 public:
                                                         void fun1()  // B中的fun1覆盖了A中的fun1,同时继承了A中的fun2
                                                         {
                                                                 cout<<"B::fun1()"<<endl;
                                                         }
                                         };
                                         class C:public B
                                         {
                                                 public:
                                                         void fun2()
                                                         {
                                                                 cout<<"C::fun2()"<<endl;  //C类继承了B中的fun1,同时重定义覆盖了fun2
                                                         }
                                         };
                                         | int main()
                                         {
                                                 A* p = new C;
                                                 p->fun1();
                                                 p->fun2();
                                                 return 0;
                                         }
                                         | 
| #include <iostream>
                                             using namespace std;
                                             class A
                                             {
                                                     public:
                                                             void fun(int xp)    //非虚函数,形参int
                                                             {   cout<<xp<<endl;   }
                                             };
                                             class B : public A
                                             {
                                                     public:
                                                     void fun(const char * s)  //隐藏,oversee,参数为字符串
                                             //参数相同,但是基类不是虚函数,构成隐藏oversee   
                                                     {   cout<<s<<endl;   }
                                                     void fun(int xp)      //重载
                                                     {   cout<<"B::fun()"<<endl;   }
                                             };
                                             | int main()
                                             {
                                                     B b;
                                                     b.fun("hello");
                                                     b.fun(2);    //B 中没有void fun(int) 会报错,基类中的被覆盖
                                                     return 0;
                                             }
                                             | 
C++中重载(overload)、覆盖(override)与隐藏(oversee)
原文:https://www.cnblogs.com/meihao1203/p/9368280.html