Tuesday, November 29, 2011

Accessibility of Class Members

In this post, I briefly summarize the accessibility of class members in C++.

Accesspublicprotectedprivate
the same classyesyesyes
derived class
public inheritance
yes
still public
yes
still protected
no
still private
derived class
protected inheritance
yes
change to protected
yes
still protected
no
still private
derived class
private inheritance
yes
change to private
yes
change to private
no
still private
friendyesyesyes
otheryesnono

References:
C++ Tutorial

Related Posts:
Friend Functions and Classes

No comments:

Post a Comment