Why protected and private inheritance are defined and proposed? I understand some cases private inheritance could be used but it is not recommended. How about protected inheritance?
Can anyone offer me an situation in which protected inheritance is a choice?
I rarely see this.
Thanks so much!
Private inheritance is usually used for mixins---where people inherit to get functionality from the base class, rather than because of "is-a" inheritance.
Protected inheritance can also be used for mixins, where the mixed-in functionality is to be available to downstream classes too.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With