来一道C++的概念题
void test();
class X
{
public:
int x;
};
class Y1 : public X
{
};
class Y2 : protected X
{
};
class Y3 : private X
{
};
class Y4 : private X
{
friend void test();
};
void test()
{
X *p = NULL;
Y1 y1;
Y2 y2;
Y3 y3;
Y4 y4;
p = &y1;......................(a)
y1.x = 7;.....................(b)
p = &y2;......................(c)
y2.x = 7;.....................(d)
p = &y3;......................(e)
y3.x = 7;.....................(f)
p = &y4;......................(g)
y4.x = 7;.....................(h)
}
===========================================
在 (a) -- (h) 这8条语句中,错误的是?