どうすればこの動作を実現できますか?
class A
{
int x;
public:
A(int x) : x(x) {}
};
class B
{
A a; // here is the problem
public:
B() : a(1) {} // solution i found
};
int main(void)
{
B b;
return 0;
}
私が見つけた答え以外に、この作品を作る別の方法があるのだろうかと思います。