Hello,
I discovered a strange (?) template behaviour in g++.
It seems like I cannot access a variable from the baseclass
in a derived class without using a scope-operator or a cast.
This error doesn't occur with Borland C++. It also doesn't
occur when I don't use templates.
Is there a compiler-switch to change this behaviour?
template <typename T>
class CTest1
{
protected:
T a;
};
template <typename T>
class CTest2 : public CTest1<T>
{
public:
void Function1()
{
a = 0; // ERROR - a undeclared
}
void Function2()
{
CTest1<T>::a = 0; // WORKS
}
void Function3()
{
T(a) = 0; // WORKS
}
};
Best regards, Martin