标签:RKE string c++ 继承 style 属性 test 私有 公有 enter
class Person {
public:
void eat();//public 权限
protected: //protected 权限
string m_strName;
int m_iAge;
private://private权限
string test;
};
class Worker : public Person {
public:
void work();
int m_iSalary;
protected:
private:
};
| 父类成员访问属性 | 继承方式 | 子类成员访问属性 |
|---|---|---|
| private成员 | public | 无法访问 |
| protected成员 | public | protected |
| public成员 | public | public |
| 父类成员访问属性 | 继承方式 | 子类成员访问属性 |
|---|---|---|
| private成员 | protected | 无法访问 |
| protected成员 | protected | protected |
| public成员 | protected | protected |
| 类成员访问属性 | 继承方式 | 子类成员访问属性 |
|---|---|---|
| private成员 | private | 无法访问 |
| protected成员 | private | private |
| public成员 | private | private |
标签:RKE string c++ 继承 style 属性 test 私有 公有 enter
原文地址:https://www.cnblogs.com/wuyanzu/p/11874258.html