Struct inheritance in C++

后端 未结 6 657
情书的邮戳
情书的邮戳 2020-12-02 05:28

Can a struct be inherited in C++?

6条回答
  •  误落风尘
    2020-12-02 05:58

    Yes. The inheritance is public by default.

    Syntax (example):

    struct A { };
    struct B : A { };
    struct C : B { };
    

提交回复
热议问题