单项选择题

下列类的定义中,有( )处语法错误。
class Base

public:
Base ( )
Base(int i)

data=i;

private:
int data;
;
class Derive : public Base

public:
Derive() : Base(O)
Derive (int x)

d=x;

void setvalue(int i)

data=i;

private:
d;
;

A.1
B.2
C.3
D.4
<上一题 目录 下一题>
热门 试题

单项选择题
以下程序执行后的输出结果是( )。 #include <iostream> using namespace std; void try(int,int,int,int); int main ( ) int x,y,z,r; x=1; y=2; try(x,y,z,r); cout<<r<<end1; return 0; void try(int x,int y, int z,int r) z = x+y; x = X*X; y = y*y; r = z+x+y;
A.18
B.9
C.10
D.不确定
单项选择题
为使程序的输出结果为: Base:: fun 那么应在下列程序画线处填入的正确语句是( )。 #include <iostream> using namespace std; class Base public: void fun () cout<< Base: :fun <<end1; ; class Derived : public Base public: void fun ( ) cout<< Derived: :fun <<end1; ; int main ( ) Base a,*pb; Derived b; _________; pb->fun(); 调用基类的成员函数 fun() return 0 ;
A.pb=&a
B.pb=b
C.pb=&b
D.pb=&Base
相关试题
  • 以下程序运行后的输出结果是 【14】 。...
  • 下列程序将x、y和z按从小到大的顺序排列,...
  • 若有以下程序: #include <iostream>...
  • 表达式operator++(x,int)还可以表示为...
  • 要想把类的一般成员函数说明为类的常成员函...