Overriding public virtual functions with private functions in C++

前端 未结 7 607
隐瞒了意图╮
隐瞒了意图╮ 2020-11-27 02:51

Is there is any reason to make the permissions on an overridden C++ virtual function different from the base class? Is there any danger in doing so?

For example:

7条回答
  •  醉酒成梦
    2020-11-27 03:31

    It can be very useful if you are using private inheritance - i.e. you want to reuse a (customized) functionality of a base class, but not the interface.

提交回复
热议问题