I'm trying to initialize an array called ARRAY
inside the constructor of a class called CLASS_A
and this array is supposed to be accessible by the nested class CLASS_B
. I thought of making the array a template but that was when things started to get a little fuzzy with how to go about the syntax.
I'm almost certain that declaring the ARRAY static is part of the solution and maybe making the type const int
a template like A
so then the template would look like template <class A, const int D>
and the declaration A ARRAY[SIZE];
. Anyways I initially got this error compiling the code below and then I made some changes and got a different error.
This is a linker error by the way
nested_class_incomplete_type.cpp|16|undefined reference to `CLASS_A<3>::ARRAY'|
nested_class_incomplete_type.cpp|28|undefined reference to `CLASS_A<3>::ARRAY'|
edit duplicate code.