具体代码如下:
#include <iostream>
using namespace std;
class Base{ //基类Base
public:int fn1(){return 0;};int fn2(){return 0;};
};
class Derived:private Base{ //派生类Derived;
public:int fn1(){return Base::fn1();}//返回Base类中函数fn1,以调用fn1;int fn2(){return Base::fn2();}//返回Base类中函数fn2,以调用fn2;
};
void main(){Derived a;//定义一个参数a;a.fn1(); //调用Derived类中的fn1函数,fn1返回值调用Base类的fn1函数;
}
来都来了,点个赞再走吧。谢谢;