There is a syntax that allows you to use the structure initialization syntax:
struct A { int a; int b; }
int main()
{
A a = { 1, 2 };
return 0;
}
in the initialization list? For instance.
class B
{
public:
B(int a_, int b_) : obj { a_, b_ } { }
private:
A obj;
};
source
share