I tested this as I thought it might work (even without Prasun's answer)
B::B() : A(), d(0)
{
}
may work because you then โinitializeโ A.
By the way, this did not happen. Conclusion: 1.32.123595988
This will work:
// put this in B.cpp anonymous namespace
const A a_init = { 0, 0 ,0 };
and then:
B::B() : A( a_init), d(0)
{
}
I am testing with g ++ 4.3.2. THIS now works :
B::B() : A(A()), d(0)
{
}
source
share