|
template <class T> class A{
class B{
T obj;
int a;
int b;
};
B * node;
public:
why_this(){
node = new B;
node -> a = 10;
node -> b = 20;
}
};
when I create object of template class inside nested class
it makes all other data members of that class
(here in this case class B) accessible to function
why_this();
where as if
class A{
class B{
int obj;
int a;
int b;
};
B * node;
public:
why(){
node = new B;
node -> a = 10;//error can not access
node -> b = 20;//can not access
}
};
why this happens?
|
|
|
|
|
|
|
// |