Why does having a base class disqualify a class from being aggregate?

后端 未结 3 1891
醉酒成梦
醉酒成梦 2021-01-17 15:57

What is it about having an aggregate public base class (or even multiple aggregate public base classes) that would make a class lose the nice properties of aggregate classes

3条回答
  •  渐次进展
    2021-01-17 16:27

    How would you initialize the base class?

    Derived d = {{1, 2}, 3, 4};
    

    Or

    Derived d = {1, 2, 3, 4};
    

    Is

    Derived d = {3, 4};
    

    permitted?

    To avoid all of this, no base classes.

提交回复
热议问题