My understand of Friend and Protected

怼烎@ 2021-12-15 09:03 300阅读 0赞

Friend

My understanding of Friend is equivalent to “project scope”.

PublicAndFriend1

Protected

The official definiton is that elements are accessible only from within their own class or from a derived class.

In OO concept, The relation between a derived class to parent class is “is-a”. For example, international student is a student.

My understanding of protected is that elements are accessible to “Same thing” only. Protected

转载于:https://www.cnblogs.com/yangbin990/archive/2009/05/05/1450191.html

发表评论

表情:
评论列表 (有 0 条评论,300人围观)

还没有评论,来说两句吧...

相关阅读