?????????????????????????????????????????????????а??????????к??????У???????????public??protected??private????????б????????????ж???c++???????

??????????????????????е??????У?

????????derived ?????base?????derived??base?????“is a”????????derived????base???????????

????????derived ??????base?????derivd??base?????“has a”????????derived??????????base???vptr????ò????Щ?????Щ????????????

??????????п??????????????й????????????????????????????????????????????????????????????????????????????????????????????ν???????????????н??????

class stream
{
public:
    stream(){cout<<"stream::stream()!"<<endl;}
};

class iistream:virtual stream
{
public:
    iistream(){cout<<"istream::istream()!"<<endl;}
};

class oostream:virtual stream
{
public:
    oostream(){cout<<"ostream::ostream()!"<<endl;}
};

class iiostream:public iistream??public oostream
{
public:
    iiostream(){cout<<"iiostream::iiostream()!"<<endl;}
};

int main(int argc?? const char * argv[])
{
    iiostream oo;
};

???????????е??????????

????stream::stream()!
????istream::istream()!
????ostream::ostream()!
????iiostream::iiostream()!

???????????????????????????????????е????????????г?????????????????????????????????濪???????н????

????stream
????/              
????istream   ostream
????                 /
????iiostream

??????????????ν??????????????????????????

????????? stream ?????????????? virtual ????stream??????????????????istream??ostream????????????????vptr???????????????stream?????????iiostream?????????????????vptr??????stream?е?????????????vptr????????????????????