My understand of Friend and Protected
Friend
My understanding of Friend is equivalent to “project scope”.
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.
转载于//www.cnblogs.com/yangbin990/archive/2009/05/05/1450191.html
还没有评论,来说两句吧...