class AAA
{
int m_Int;
public:
AAA() : m_Int{12} {}
};
class BBB
{
int m_Int1;
public:
BBB() : m_Int1{12} {}
};
class CCC : public AAA, public BBB {};
AAA a;
BBB b;
CCC c{ a, b };
Why can object c
be constructed by parent class object?
I tried to find out which standard support this syntax. I wrote the code with Visual Studio, and I found C++ 14 does not support this, but C++17 does. I also found that the construct process of c
call AAA
and BBB
's copy constructor.
I want to know what the syntax is and where to find the item.