?????????private???
???????????? ???????[ 2012/10/24 10:48:56 ] ????????
??????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?????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11