Inheritance of class seems to work oddly inside a template class
template<typename T>
class b
{
public:
class base
{
public:
int a = 2;
};
class A : public base
{
public:
void fun()
{
cout << a << endl;
}
};
};
When this piece of code is compiled, compiler would regard a as not declared(in A::fun())
However, if you write this->a
instead of a, everything is ok
Question is: why won't the compiler interpret a as this->a
(as it does in normal class)