How do you use the non-default constructor for a member?

You need to call a(int) explicitly in the constructor initializer list:

b() : aInstance(3) {} 

Where 3 is the initial value you’d like to use. Though it could be any int. See comments for important notes on order and other caveats.

Leave a Comment