??????C++??????????????з????????????????????д????????????public??У????????????private??С???????????????????????????????????public??У???????????public??У???????????????Щ???????????????????????????????????????????????????a??????private??С?

????As we all know??public?????????????is-a?????????is-a???????Effective C++?????????????????class D??public?μ??class B??????????????D??????????????????B?????????????????????B??D?????????????????D??B?????????????????????“B??????????ó???????D????????????????ó?”?????????D?????????????????B??????????????????D????B???????Ч???

????????????????????virtual???????????ж??????????public????????

??????????C++???????private??У????ж?????????public?????protected??????????private?????????????????????????????????????????????????????????????????Щ??????????????????С???private??е?????ζ???????

?????????????????

class Person{...};
class Student:private Person{...};
void eat(const Person &p);
Person p;
Student s;
eat(p);//???
eat(s);//????

?????????Effective C++???????

???????classes?????й????private????????????????????deirved class???????????base class????

????private?????ζ??implemented-in-terms-of????????????????????????class D??private???class B?????????????????class B???????????Щ????????????B?????D??????????κι??????????private??д??????????????????ζ??????????????У??????????????????D??private??????B???????D???????B???????????private??????????????????????壬???????????????????檔

????private?е?has-a??о?????????????????????????????????????????????????????????????private??У????????????????????????????μ?2???????

????1??private??????????????????????derived class???????protected base class???????????????????ж?????virtual??????????private??С?

????2??private??п??????empty class?????