F
filip.konvicka
Hi, I'm having problems with the following code:
template<typename T> struct A {
T i;
};
template<typename T> struct B : public A<T> {
void access_i() { i; }
};
g++ 4.2.2 complains that
'i' was not declared in this scope
in B<T>::access_i() definition. Of course, when I use
void access_i() { A<T>::i; }
everything's OK, but I don't see why I need to use this. Can anyone
please explain why this is?
The code compiles fine with MSVC, and I'd like to keep the code
readable...
Thanks,
Corn
template<typename T> struct A {
T i;
};
template<typename T> struct B : public A<T> {
void access_i() { i; }
};
g++ 4.2.2 complains that
'i' was not declared in this scope
in B<T>::access_i() definition. Of course, when I use
void access_i() { A<T>::i; }
everything's OK, but I don't see why I need to use this. Can anyone
please explain why this is?
The code compiles fine with MSVC, and I'd like to keep the code
readable...
Thanks,
Corn