公有(public)继承
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 |
保护(protected)继承
private成员 |
protected |
无法访问 |
protected成员 |
protected |
protected |
public成员 |
protected |
protected |
私有(private)继承
private成员 |
private |
无法访问 |
protected成员 |
private |
private |
public成员 |
private |
private |
C++ 继承
原文:https://www.cnblogs.com/wuyanzu/p/11874258.html