I have stuck with the following code in some project (it is simplification).
template <class X >
class A {
public:
int a;
};
class Y;
class B : public A<Y> {
void foo() {a = 0;}
};
template < class D >
class C : public A<D> {
void foo() {a = 0;}
};
The compiler fails with:
test.cpp:14:14: error: ‘a’ was not declared in this scope
Why in the C::foo the compiler fails to recognize A::a and in B::foo does not? Thanks.