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》 

    当你的才华还撑不起你的野心时,那你就应该静下心来学习。
  • 相关阅读:
    02-02:springboot 整合filter
    02-01:springboot整合servlet开发
    01-SpringBoot项目:helloworld
    SpringBoot
    JavaScript面试题
    vue的生命周期
    小程序下的兼容性问题
    短短几行css代码实现滚动条效果
    Apache服务器的安装和配置
    闭包
  • 原文地址:https://www.cnblogs.com/aceg/p/6942637.html
Copyright © 2011-2022 走看看