分类: C/C++
2010-06-17 16:40:46
class c00
{
private:
int c00a;
};
class c10 : public c00
{
private:
int c10a;
public:
void f(const c00 & c) // ok 规则1
{
}
};
class c11 : protected c00
{
private:
int c11a;
public:
void f(const c00 & c) // ok 规则5
{
}
};
class c12 : private c00
{
private:
int c12a;
public:
void f(const c00 & c) //ok 规则5
{
}
};
class c21 : public c11
{
private:
int c21a;
public:
void f(const c00 & c) // ok 规则4
{
}
};
class c22 : public c12
{
private:
int c22a;
public:
void f(const c00 & c) //error 规则3
{
}
};
void f(const c00 & c)
{
}
void main()
{
c10 t10;
c11 t11;
c12 t12;
f(t10); // ok 规则1
f(t11); //error 规则2
f(t12); //error 规则2
}