I created a class with a constructor that takes an int to determine the size of a linked list the object has. The problem I'm having is I need to be able to call this constructor when this object is instantiated as a private member of another class. So basically:
class A {
public:
A();
A(int size);
};
class B {
const int size = // any number > 0
private:
A a(size);
};
I get this error:
constant "B::size" is not a type name
I've tried searching online, but I can't come across this specific issue. It could be that I'm struggling to word the question correctly... it's a weird issue I haven't seen yet. Any help is appreciated!
A a(size);is wrong, should beA a;and initialize theamember in classB's constructor member initialization list.