有如下程序:#include<iostream>using namespace std;class Book{public:Book(char*t=””){s

15 查阅

有如下程序:

#include<iostream>

using namespace std;

class Book{

public:

Book(char*t=””){strcpy(title,t);}

private:

char title[40];

};

class Novel:public Book{

public:

Novel(char *t=””):Book(t){}

char*Category()const{return”文学”;)

};

int main(){

Book *pb;

pb=new Novel();

cout<<pb->Category();

return 0;

}

若程序运行时输出结果是“文学”,则划线处缺失的语句是

A.char*Category();

B.char*Category()const;

C.virtual char*Category()const;

D.virtual char*Category()const=0;

参考答案:

D

计算机二级