Let\'s look at this simple code sample including a base class and a class derived from Base, which needs the address of a base class member in its constructor.
#
In the second case, the Base
is a template and someone might add specializations for the template, all with different member variables. The compiler cannot know until it sees what T
is.
There might also be a global arr
that could fit. You can help the compiler by using this->arr[0]
to indicate that it always is a member variable.