有如下程序: #include<iostream.h> class Base { protected:int i; public:int j; }; class Derived:public Base { int m; public:int n; }; int main() { Derived d; d.i=0; //[1]d.j=0; //[2]d.m=0; //[3]d.n=0; //[4]return 0; } 其中主函数中有两个赋值语句有错,这两个错误的赋值语句是( )。
A.[1]和[2]
[单选题]下面程序的运行结果是includeclass base{protected:int a;public:base( ){cout<<"0下面程序的运行结果是 #include<iostream.h> class base{ protected: int a; public: base( ){cout<<"0";} }; class basel:virtual base { public: base1( ){cout<<"1";} }; class base2:virtual base{
[单选题]有如下类声明: class Base{ protected: int amount; public: Base(int n=0):araount(n){ } int getAmount( )const{retum amount;} }; class Derived:public Base{ protected; int value; public: Derived(int m,int n):value(n1),Base(n){ } int getData( )const{return value
[单选题]有如下类的声明: class Base{ protected: int amount; public: Base(int n=0):amount(n){} int getAmount()const{return amount;} }; class Derived:public Base{ protected: int value public: Derived(int m,int n):value(m),Base(n){} int getData()const{return value+amou
[单选题]有如下程序:class Base{public:int data;};class Derived1:public Base{};class Derived2:protected Base{};int main(){D.erived1 d1;D.erived2 d2;d1. data=0; //①d2. data=0; //②return 0;}下列关于程序编译结果的描述中,正确的是( )。A.) ①②皆无编译错误B.) ①有编译错误,②无编译错误C.) ①无编译错误,②有编译错误D.) ①②皆有
[单选题]有如下程序段:int i=4;int J=1:int main(){int i=8,J=i;cout<<i<<j<<endl;}运行时的输出结果是A.44B.41C.88D.81
[单选题]( 19 )有如下程序段:int i=5;while ( int i=0 ) {cout 《 '*';i--;}运行时输出 "*" 的个数是A. ) 0B. ) 1C. ) 5D. )无穷
[单选题]有如下程序:includeusing namespace std;int i=1;class Fun{public:static int i;int有如下程序: #include<iostream> using namespace std; int i=1; class Fun { public: static int i; int value(){return i-1;} int value()const{return i+1;} }; int Fun::i=2; int main() { i
[单选题]( 20 )有如下程序段int i =0, j=1;int & r=i ; // ①r =j; // ②int*p= & i ; // ③*p= & r ; // ④基中会产生编译错误的语句是A. ) ④B. ) ③C. ) ②D. ) ①
[单选题]有如下程序: include class x { protected: int a; public:x(){ a=1;} }; class x有如下程序: #include <iostream.h> class x { protected: int a; public: x() { a=1; } }; class x1 : virtual public x { public: x1() { a+=1; cout<<a; } }; class x2 : virtual public x { pu
[单选题]有如下程序段:int i=1:while(1){i++;if(i==210) break;if(i%2==0) cout<<‘*’;}执行这个程序段输出字符*的个数是A.10B.3C.4D.5