关于嵌套类访问外围类私有成员的问题
class List
{
public:
private:
static const int a = 3;
enum ListStatus{ Good, Empty, Corrupted };
class ListItem
{
public:
const char cc[a];
ListStatus status;
ListItem( int val = 0 );
void tt(){ List::a; } // a虽然是静态,但它是私有的!!!
};
};
在List没有把ListItem声明为友元的情况下,应该不可以访问List的私有成员(不管
其类型是不是静态的!!!) 可我在void tt()中使用List::a为什么能通过呢?