三种属性访问全权限:
|
类成员函数 |
子类函数 |
友元函数 |
该类对象 |
类外 |
public |
√ |
√ |
√ |
√ |
√ |
protected |
√ |
√ |
√ |
× |
× |
private |
√ |
× |
√ |
× |
× |
类继承方法属性变化
|
public |
protected |
private |
public继承 |
public |
protected |
private |
protected继承 |
protected |
protected |
private |
private继承 |
private |
private |
private |