单项选择题

有以下程序
#include <iostream>
using namespace std:
class Baseprivate:
char c;
public:
Base(char n) :c(n)
~Base ( )
cout<<c;
;
class Derived : public Baseprivate:
char c;
public:
Derived(char n):Base(n+1),c(n)
~Derived()
cout<<c;
;
int main() Derived obj(’x’);
return 0; 执行后的输出结果是

A.xy
B.yx
C.x
D.y
<上一题 目录 下一题>
热门 试题

单项选择题
有以下程序#include <iostream>using namespace std;int a;int fun ();int main () extern int a; int b; a = 100; b = fun(); cout<<b<<end1; return 0;int fun) extern int a; return (10*a ; 其程序运行后的输出结果是
A.100
B.10
C.1000
D.10000
单项选择题
有如下程序:#include <iostream>using namespace std;class point int x, y;public: point( int vx, int vy ) x = vx; y = vy; point ( ) x = 0; y= 0; point operator+( point p1 ) point p; int px = x+ p1.x; int py = y + p1.y; return point( px, py ); point operator-( point p1 ) point p; int px = x -p1.x; int py = y - p1.y; return point ( px, py ); void print() cout<<x<< , <<y<<end1;;int main () point p1(10, 10 ), p2( 20, 20 ); p1 = p1 - p2; p1.print (); return 0; 执行后的输出结果是
A.10,10
B.20,20
C.10,20
D.30,30
相关试题
  • 下面程序的输出结果是 【15】 。#incl...
  • 下列程序的输出结果是 【14】 。#incl...
  • 下面程序的输出结果为:Base:: fun,请...
  • C++中,设置虚基类的目的是 【11】 。
  • 多态性分为两类:编译时的多态性和 【10...