(一)在上一篇012_LINUXC++之_类的继承定义中我们知道在派生类中可以访问public和protectd中的数据
(二)那么我们就可以在派生类中将上面两个中的数据进行权限的修改
(三)程序
#include <iostream>
using namespace std;
class Father{
public:
int test1;
private:
int test2;
protected:
int test3;
};
class Son:public Father{
public:
using Father::test3; /*将test3修改成为public,那么外部就可以使用*/
};
int main(int argc, char **argv)
{
Son S;
S.test1 = 0;
S.test3 = 0;
}
(四)更改权限使用using