派生说明(Derived description).docVIP

  • 5
  • 0
  • 约1.29万字
  • 约 17页
  • 2017-10-06 发布于河南
  • 举报
派生说明(Derived description)

派生说明(Derived description) When a subclass inherits from a parent class, all members of the parent class become members of the subclass, and access to the parent class members is determined by the inheritance qualifier used at inheritance time. 1. if the inheritance qualifier used when the subclass inherits from the parent class is public, then (1) the public members of the parent class become public members of subclasses, allowing code other than classes to access those members; (2) the private members of the parent class are still members of the private class of the parent class, and the members of the subclass are not allowed to access them; (3) the protected member of the parent class becomes the protected member of the subclass, allowing only the subclass members to access; 2. if the inheritance qualifier used when the subclass inherits from the parent class is private, then (1) the public member of the parent class becomes the private member of the subclass, allowing only the subclass members to access; (2) the private members of the parent class are still members of the private class of the parent class, and the members of the subclass are not allowed to access them; (3) the protected member of the parent class becomes the private member of the subclass, allowing only the subclass members to access; 3. if the inheritance qualifier used when the subclass inherits from the parent class is protected, then (1) the public member of the parent class becomes the protected member of the subclass, allowing only the subclass members to access; (2) the private members of the parent class are still members of the private class of the parent class, and the members of the subclass are not allowed to access them; (3) the public member of the parent class becomes the protected member of the subclass, allowing only the subclass members to access; As for the different members of the class (public, private and protected) access status not elaborate. C++ access rights and derived

您可能关注的文档

文档评论(0)

1亿VIP精品文档

相关文档