第六章单元测试
- 虚继承主要作用是解决多重继承中二义性的问题。( )
- 以下成员函数表示纯虚函数的是 ( )
- 若一个类中含有纯虚函数,则该类称为 ( )
- 在派生类中,编写一个虚函数时,要求函数名、参数的个数、参数的类型、参数的顺序和函数的返回值 ( )
- 基类指针可以指向派生类对象,派生类指针也可指向基类对象。( )
- When a class is derived from a class with a pure virtual function and no definition is supplied for that pure virtual function in the derived class, that derived class is also an abstract class. ( )
- Choose the correct statement? ( )
- #include<stdio.h>
class Base{
public:
virtual void show() {printf("In Base; "); }
};
class Derived: public Base{
public:
void show() { printf("In Derived; "); }
};
void main(){
Base *bp = new Derived;
bp->show();
}
Output? ( )
A:对 B:错
答案:对
A:virtual int vf(int); B:virtual void vf(int) {} C:void vf(int) = 0; D:virtual void vf() = 0;
A:抽象类 B:派生类 C:虚基类 D:友元类
A:相同 B:根据程序开发者意图而定 C:部分相同 D:不同
A:错 B:对
A:对 B:错
A:Abstract class cannot be inherited B:Abstract class cannot have normal functions. C:Abstract class is a class which contains at least one Pure Virtual function in it. D:Abstract class can be instantiated.
A:In Base; In Derived; B:In Derived; In Base; C:In Base; D:In Derived;
温馨提示支付 ¥3.00 元后可查看付费内容,请先翻页预览!