??????c++???п????У???????????????????????public??protected??private????????????????????????????????????????????????????struct????????????public??У?class????????????private??С????Java?к???????Java??????public??У???????й??м?С?
????1.???public???????????????????????????public??protected????????????????????????????????????public?????
??????1???????public??????????????????public???
??????2???????е?protected??????????????????protected???
??????3???????е?private????????????в???????
????2.???protected???????????????????????????public??protected?????????????????????????????????????????????????????????????г??????????????????е?public??protected???????
??????1???????public????????????б??protected?????
??????2???????protected??????????????????protected?????
??????3???????е?private????????????в???????
????3.???private???????????????????????????public??protected?????????????????????????????????????????????????????????????г??????????????????е?public??protected???????
??????1???????public????????????б??private?????
??????2???????protected????????????б??private?????
??????3???????private????????????в???????
???????????????????????????????????????????????
?????? ?? ?? ? ?????public??? ?????protected??? ?????private??? public???? ????public??? ???protected??? ????? protected???? ???protected??? ????protected??? ????? private???? ???private??? ???private??? ?????
??????????????????
????#include <iostream> 
????class Base { 
????public: 
????int public_a; 
????virtual void test() = 0; 
????protected: 
????int protected_a; 
????private: 
????int private_a; 
????}; 
????//???м?? 
????class PublicDerived : public Base { 
????public: 
????virtual void test() { 
????public_a = 1;                   //public_a public??к???public???? 
????protected_a = 2;                //protected_a ????protected???? 
????//private_a = 3;                  //????????????????г?? 
????} 
????}; 
????//??????? 
????class ProtectedDerived : protected Base { 
????public: 
????virtual void test() { 
????public_a = 1;                   //public_a protected??к???protected???? 
????protected_a = 2;                //protected_a ????protected???? 
????//private_a = 3;                //????????????????г?? 
????} 
????}; 
????//??м?? 
????class PrivateDerived : private Base { 
????public: 
????virtual void test() { 
????public_a = 1;                   //public_a private??к???private???? 
????protected_a = 2;                //protected_a private??к???private???? 
????//private_a = 3;                //????????????????г?? 
????} 
????}; 
??????c++??public?????is-a??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????