正在加载图片...
Access control u Controlling how the member functions and data members could be accessed Public- could be accessed outside the class Protected-could only be accessed by those classes deriving from it, or by friend classes and functions Private- could only be accessed inner this class or by friend classes and functions Suggestion: Avoid exposing the data members in the public interface, Use accessing functions insteadAccess control ◼ Controlling how the member functions and data members could be accessed ◼ Public – could be accessed outside the class ◼ Protected – could only be accessed by those classes deriving from it, or by friend classes and functions ◼ Private – could only be accessed inner this class, or by friend classes and functions ◼ Suggestion: Avoid exposing the data members in the public interface, Use accessing functions instead
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有