#include <stdio.h>
template<class T>
class C
{
public:
struct A
{
T x;
};
struct B: A
{
int y;
B() {
x = 10;//error
}
};
};
int main(void)
{
C<int>::B b;
b.x = 5; //right
b.y = 6;
return 0;
}
见此:
http://blog.codingnow.com/2010/01/cpp_template.html
及此:
http://gcc.gnu.org/onlinedocs/gcc-4.4.3/gcc/Name-lookup.html#Name-lookup