virtual function in private or protected inheritance

前端 未结 5 2209
予麋鹿
予麋鹿 2021-02-12 22:52

It\'s easy to understand the virtual function in public inheritance. So what\'s the point for virtual function in private or protected inheritance?

For example:

5条回答
  •  北荒
    北荒 (楼主)
    2021-02-12 23:17

    • There doesn't need to be a point to every combination of different features. You're simply allowed to combine them.
    • A virtual protected member is accessible to derived classes, so it's useful to them.
    • A virtual private member is accessible to friend classes, so it's useful to them.

提交回复
热议问题