zoukankan      html  css  js  c++  java
  • Private Inheritance for C++

      C++ has a second means of implementing the has-a relationship: private inheritance.With private inheritance, public and protected members of the base class become private members of the derived class.This means the methods of the base class do not become part of the public interface of the derived object.They can be used, however, inside the member functions of the derived class.
    Let’s look at the interface topic more closely.With public inheritance, the public methods of the base class become public methods of the derived class. In short, the derived class inherits the base-class interface.This is part of the is-a relationship.With private inheritance, the public methods of the base class become private methods of the derived class. In short, the derived class does not inherit the base-class interface.As you saw with contained objects, this lack of inheritance is part of the has-a relationship.  

                                                                from 《c++ primer plus》 

    当你的才华还撑不起你的野心时,那你就应该静下心来学习。
  • 相关阅读:
    【大数据】Hadoop常用启动命令
    Codeforces Round #695 (Div. 2)
    Codeforces Round #668 (Div. 2)
    Codeforces Round #666 (Div. 2)
    Educational Codeforces Round 94 (Rated for Div. 2)
    Sum Queries? CodeForces
    New Year and Old Subsequence CodeForces
    Gym
    huntian oy HDU
    The Boss on Mars HDU
  • 原文地址:https://www.cnblogs.com/aceg/p/6942637.html
Copyright © 2011-2022 走看看