单项选择题

有如下程序:
#nclude <iostream>
using namespace std;
class Base public:
void fun1() cout << "Base\n";
virtual void fun2() cout << "Base\n";
;
class Derived: public Base public:
void fun1() cout << "Derived\n";
void fun2() cout << "Derived\n"; void f(Base& b) B. fun1(); B. fun2();
int main()Derived obj;
f(obj);
return 0;

A.Base
Base
B.Base
Derived
C.Derived
Base
D.Derived
Derived
<上一题 目录 下一题>
热门 试题

单项选择题
有以下程序:#include <iostream>using namespace std;class sample private: int n;public: sample() sample(int m) n=m; sample add(sample s1,sample s2) this->n=s1. n+s2.n; return (*this); void disp() cout<< n= <<n<<end1; ;int main() sample s1(10),s2(5),s3; s3.add(s1,s2); s3.disp(); return 0,
A.n=10
B.n=5
C.n=20
D.n=15
单项选择题
以下程序中函数scmp功能是返回形参指针s1和s2所指字符串中较小字符串的首地址。#includ<string. h>char *scmp(char *s1,char *s2) if(strcmp(s1,s2)<0) return(s1); else return(s2);main() int i;char string[20],str[3][20]; for(i=0;i<3;i++) gets(str[i]); strcpy(string,scmp(str[0],str[1])); 库函数 strcpy 对字符串进行复制 strcpy(string,scmp(stfing,str[2])); puts(string); 若运行时依次输入: abed、abba 和abc三个字符串,则输出结果为( )。
A.abed
B.abba
C.abc
D.abca
相关试题
  • 软件开发模型包括( )。 Ⅰ 瀑布模型 ...
  • 下面程序的结果是( )。#include<iostr...
  • 关于语句#include<iostream>using name...
  • 下面关于成员函数重载运算符和友元函数重载...
  • 关于静态数据成员的描述中正确的是( )。