原来私有继承的用using可以变对象的公有可见函数...
#include<iostream>using namespace std;
class Base{
private:
int x;
public:
virtual void mf1()=0;
//virtual void mf2(int);
virtual void mf2();
void mf3();
void mf3(double);
};
void Base::mf2()
{
cout<<"Base"<<endl;
};
class Derived: private Base
{
public:
using Base::mf1;
using Base::mf2;
void mf1();
void mf3();
void mf4();
};
void Derived::mf1()
{
cout<<"Derived"<<endl;
mf2();
};
int main()
{
Derived a;
a.mf1();
a.mf2();
return 0;
}
学习需要安静。。海盗要重新来过。。