预测C++程序的输出
null
#include<iostream> using namespace std; class Base { public : virtual void show() { cout<< " In Base " ; } }; class Derived: public Base { public : void show() { cout<< "In Derived " ; } }; int main( void ) { Base *bp = new Derived; bp->Base::show(); // Note the use of scope resolution here return 0; } |
(A) 在基地 (B) 派生的 (C) 编译错误 (D) 运行时错误 答复: (A) 说明: 基类函数可以通过作用域解析运算符访问,即使该函数是虚拟的。 这个问题的小测验
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END