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.
More Related Contents:
- Why is there no call to the constructor? [duplicate]
- How do you pass a member function pointer?
- no default constructor exists for class
- C++ virtual function from constructor [duplicate]
- Is passing a C++ object into its own constructor legal?
- Error: cannot bind non-const lvalue reference of type ‘int&’ to an rvalue of type ‘int’
- Will an ’empty’ constructor or destructor do the same thing as the generated one?
- Is a `=default` move constructor equivalent to a member-wise move constructor?
- How to add constructors/destructors to an unnamed class?
- “No appropriate default constructor available”–Why is the default constructor even called?
- Different ways of initializing an object in c++
- No matching function for call to Class Constructor
- Class inherited from class without default constructor
- default visibility of C++ class/struct members
- C++ Member Initializer List
- Scope resolution operator being used twice
- Questions regarding constructors
- What is this weird colon-member (” : “) syntax in the constructor?
- Unresolved external symbol on static class members
- How do you create a static class in C++?
- call to pure virtual function from base class constructor
- Why should default parameters be added last in C++ functions?
- How can I get the class name from a C++ object?
- Destructors of builtin types (int, char etc..)
- Can class template constructors have a redundant template parameter list in c++20
- How can I avoid including class implementation files?
- Initializing a union with a non-trivial constructor
- Constructor initialization Vs assignment
- passing object by reference in C++
- Can you start a class name with a numeric digit?