I want to create an default constructor for my object A. My problem is that one of A object`s variables is a vector array B objects.
Basically the line giving my trouble currently looks like this:
A(): name(""), bArray({B()}), n(0) {}
It must be some syntax issue.
Full constructor looks like that:
A(string n, vector<B> in, int k): name(n), bArray(in), n(k) {}
You don’t need to initialize the
vectorin the initializer list. Member classes are already constructed using the default constructor, which, in your case, will initialize your vector to an empty one.