C++: Can a struct inherit from a class?

后端 未结 9 959
执笔经年
执笔经年 2020-12-07 14:39

I am looking at the implementation of an API that I am using.

I noticed that a struct is inheriting from a class and I paused to ponder on it...

First, I d

9条回答
  •  感情败类
    2020-12-07 14:45

    A struct is the same thing as a class except that a class defaults its members to private while a struct defaults its members to public. As a result, yes, you can inherit between the two. See in C++, can I derive a class from a struct.

提交回复
热议问题