Difference between private, public, and protected inheritance

后端 未结 16 2151
灰色年华
灰色年华 2020-11-21 06:15

What is the difference between public, private, and protected inheritance in C++?

16条回答
  •  耶瑟儿~
    2020-11-21 06:47

    It's essentially the access protection of the public and protected members of the base class in the derived class. With public inheritance, the derived class can see public and protected members of the base. With private inheritance, it can't. With protected, the derived class and any classes derived from that can see them.

提交回复
热议问题