单项选择题

下列类的定义中,有( )处语法错误。
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
相关试题
  • 以下函数实现的功能是 ( )。 void fu...
  • 以下程序段有( )处错误。 #include ...
  • 下列函数中,哪项是正确的递归函数( )。
  • 类 Contain 的定义如下: class Contai...
  • 有以下程序: #include <iostream> u...