C++中有三种访问权限:private,protected,public
________________________________________________
1. private
只能在类内部访问
2. protected
可以在类内部和子类中访问
3. public
在任何地方都可以被访问
________________________________________________
C++中有三种继承方式:private继承,protected继承,public继承
这三种继承方式,对于访问特性,如下所示:
________________________________________________
基类访问特性 继承方式 子类的访问特性
private no access
protected private private
public private
------------------------------------------------
private no access
protected protected protected
public protected
------------------------------------------------
private no access
protected public protected
public public
________________________________________________
阅读(5139) | 评论(0) | 转发(0) |