#include<iostream>
using namespace std;
class Base
{
public:
void show()
{
show3();
}
protected:
virtual void show2()
{
cout<<"2"<<endl;
}
private:
virtual void show3()
{
cout<<"3"<<endl;
}
};
class A : public Base
{
private:
void show3()
{
cout<<"34"<<endl;
}
};
int main()
{
A *a = new A();
a->show();
return 0;
}
c++ 中所有的访问都可以为virtual 且可以被重载
c++
最新推荐文章于 2021-09-22 22:57:02 发布