正在加载图片...
Base basep, b; Derive d basep->Show( basep=&b: 即指向派生类新增的成员函数 basep=&d;|需要将基类中的Show( 说明为虚函数 基类对象 派生类对象 basep basep Showo Showo Base b Derive d ShowO basep-> ShowO24 基类对象 派生类对象 Base b; Derive d; basep basep x Show() x Show() y Show() basep->Show() Base *basep,b; Derive d; basep=&b; basep=&d; basep ->Show(); 即指向派生类新增的成员函数 需要将基类中的Show() 说明为虚函数
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有