关闭

基类和成员的访问权限(msdn)

标签: classaccess
747人阅读 评论(0) 收藏 举报
分类:

 

成员访问控制

访问类型
含义
private
Class members declared as private can be used only by member functions and friends (classes or functions) of the class.
protected
Class members declared as protected can be used by member functions and friends (classes or functions) of the class. Additionally, they can be used by classes derived from the class.
public
Class members declared as public can be used by any function.

 
 
基类中的成员访问权限

private
protected
Public
Always inaccessible regardless of derivation access
Private in derived class if you use private derivation
Private in derived class if you use private derivation
 
Protected in derived class if you use protected derivation
Protected in derived class if you use protected derivation
 
Protected in derived class if you use public derivation
Public in derived class if you use public derivation

 
0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:245075次
    • 积分:3767
    • 等级:
    • 排名:第8499名
    • 原创:135篇
    • 转载:10篇
    • 译文:0篇
    • 评论:15条
    文章分类
    最新评论