有如下程序: #inCludeiostream using namespaCe std; Class Book{ publiC: Book(Char*t=””){strCpy(title,t);} private: Char titlel40]; }; Class Novel:publiC Book{ publiC: Novel(Char*t=””):Book(t){} Char*Category( )Const{return”文学”;} }; int main( ){ Book * pb; pb=new Novel( ); Coutpb→Category( ); delete pb; return 0; } 若程序运行时输出结果是“文学”,则横线处缺失的语句是( )。A.Char*Category( );B.Char*Category( )Const;C.virtual Char*Category( )Const;D.virtual Char*Category( )Const=0;
有如下程序: #inClude<iostream> using namespaCe std; Class Book{ publiC: Book(Char*t=””){strCpy(title,t);} private: Char titlel40]; }; Class Novel:publiC Book{ publiC: Novel(Char*t=””):Book(t){} Char*Category( )Const{return”文学”;} }; int main( ){ Book * pb; pb=new Novel( ); Cout<<pb→Category( ); delete pb; return 0; } 若程序运行时输出结果是“文学”,则横线处缺失的语句是( )。
A.Char*Category( );
B.Char*Category( )Const;
C.virtual Char*Category( )Const;
D.virtual Char*Category( )Const=0;
相关考题:
以下选项中正确的语句组是A)char s[]; s="BOOK!";B)char *s; s={"BOOK!"};C)char s[10]; s="BOOK!";D)char *s; s="BOOK!";
(32)以下选项中正确的语句组是A)char s[];s=”BOOK!”; B) char *s;s={”BOOK!”};C)char s[10];s=”BOOK!”; D) char *s;s=”BOOK!”;
( 12 )请将下面的程序补充完整,使得程序输出 “ 飘是张娜的书 ” 。#include iostreamusing namespace std;class Book{public:Book(char *str) {strcpy(title,str);}【 12 】 void PrintInfo() {couttitleendl;}protected:char title[50];};class MyBook:public Book{public:MyBook(char *s1,char *s2= " 张娜 " ):【 13 】 {strcpy(owner,s2);}virtual void PrintInfo() {couttitle " 是 " owner " 的书 " endl;}private:char owner[10];};int main(){Book *prt=new MyBook( " 飘 " );prt-PrintInfo();return 0;}
下列选项中正确的语句是( )。A.chars[3];s="BOOK!";B.char*s;s={"BOOK!"};C.chars[10];s="BOOK";D.char*S;s="BOOK!";
请将下面的程序补充完整,使得程序输出“飘是张娜的书”。includeusing namespace stdclass Book{public:Book(char*str)|strcpy(title,str);______void Printlnfo(){cout<<title<<endl;}protected:char title[50];};class MyBook:public Book{public:MyBook(char*s1,char*S2=“张娜”):______strcpy(owner,s2);}virtual void PrintInfo(){cout<<title<<“是”<<owner<<“的书”<<endl;}private:charowner[10];};int main(){Book*ptr=new MyBook(“飘”);ptr-Printlnfo();return 0;}
有如下程序:#includeiostreamusing 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();coutpb-Category();return 0;}若程序运行时输出结果是“文学”,则划线处缺失的语句是A.char*Category();B.char*Category()const;C.virtual char*Category()const;D.virtual char*Category()const=0;
以下选项中正确的语句组是______。A.chars[];s="BOOK!";B.char*s;s={"BOOK!"};C.chars[10];s="BOOK!";D.char*s;S="BOOK!";
下列选项中正确的语句是( )。A.chars[];s="BOOK!";B.char*s;S={"BOOK!");C.chars[10];s="BOOK";D.char*S;s="BOOK!";
下列选项中正确的语句是( )。A.chars[];s=BOOK!;B.char*s;S={BOOK!);C.chars[10];s=BOOK;D.char*S;s=BOOK!;