更多"下列程序的输出结果为: Objectid=O Obiectid=1"的相关试题:
[填空题]下列程序的输出结果为
Objectid=O
Obiectid=1
请将程序补充完整。
#include<iostream>
using namespace std;
class Point
{
public:
Point(int xx=0,int yy=0){X=xx;Y=yy;countP++;}
~Point( ){countP--;}
int GetX( ){return X;}
int GetY( ){return Y;}
static void GetC( ){cout<<"Object id="<<countP<<end1;}
private:
int X,Y;
static int countP;
};
______//静态数据成员的初始化
int main( )
{
Point::GetC( );
Point A(4,5);
A.GetC( );
return 0;
}
[填空题]下列程序的输出结果为
Objectid=O
Obiectid=1
请将程序补充完整。
#include<iostream>
using namespace std;
class Point
public:
Point(int xx=0,int yy=0)X=xx;Y=yy;countP++;
~Point( )countP--;
int GetX( )return X;
int GetY( )return Y;
static void GetC( )cout<<"Object id="<<countP<<end1;
private:
int X,Y;
static int countP;
;
______//静态数据成员的初始化
int main( )
Point::GetC( );
Point A(4,5);
A.GetC( );
return 0;
[填空题]下列程序的输出结果为:
Objectid=O
Obiectid=1
请将程序补充完整。
#include<iostream>
using namespace std;
class Point
public:
Point(int xx=0,int yy=0)X=xx;Y=yy;countP++;
~Point( )countP--;
int GetX( )return X;
int GetY( )return Y;
static void GetC( )cout<<"Object id="<<countP<<endl;
private:
int X,Y;
static int countP;
;
______//静态数据成员的初始化
int main( )
Point::GetC( );
Point A(4,5);
A.GetC( );
return 0;
[填空题]下列程序的输出结果为2,请将程序补充完整。
using namespace std;
class Base
public:
【12】 void fun( ) cout<<1;
;
class Derived:public Base
public:
void fun( ) cout<<2;
int main( )
Base*p=new Derived;
p->fun( );
delete p;
return 0’;
[填空题]下列程序的输出结果为2,请将程序补充完整。
#include<iostream>
using namespace std;
class Base
{
public:
______void fun( ){cout<<1;}
};
class Derived:public Base
{
public:
void fun( ){cout<<2;}
};
int main( )
{
Base*p=new Derived;
p->fur( );
delete p;
return 0;
}
[填空题]下列程序的输出结果为2,请将程序补充完整。
#include <iostream>
using namespace std;
class Base
{
public:
【12】 void fun( ) {cout<<1;}
};
class Derived: public Base
{
public:
void fun( ) {cout<<2; }
};
int main( )
{
Base *p=new Derived;
p->fun( );
delete p;
return 0;
}
[填空题]下列程序的输出结果为2,请将程序补充完整。
#include<iostream>
using namespace std;
class Base
public:
______void fun( )cout<<1;
;
class Derived:public Base
public:
void fun( )cout<<2;
;
int main( )
Base*p=new Derived;
p->fur( );
delete p;
return 0;
[填空题]下列程序的输出结果为
Object id=0
Object id=1
请将程序补充完整。
#include <iostream>
using namespace std;
class Point
{
public:
Point(int xx=0,int yy=0) {X=xx;Y=yy;countP++;}
~Point( ){countP--;}
int GetX( ){return X;}
int GetY( ){return Y;}
static Void GetC( ){cout<<"Object id="<<countP<<endl;}
private:
int X,Y;
static int countP;
};
______ //静态数据成员的初始化
int main ( )
{
Point::GetC( );
Point A(4,5);
A.GetC( );
return 0;
}
[填空题]下列程序的输出结果为
Object id=0
Object id=1
请将程序补充完整。
#include <iostream>
using namespace std;
class Pointpublic:
Point(int xx=0,int yy=0) X=xx; Y=yy; countP++;
~Point( )countP--;
int GetX( )retum X;
int GetY( )return Y;
static void GetC( ) cout<<"Object id="<<countP<<end1;
private:
int X,Y;
static int countP;
;
【11】 //静态数据成员的初始化
int main( ) Point:: GetC( );
Point A(4,5);
A. GetC( );
retum 0;
[填空题]下面程序的输出结果为:Base:: fun,请将程序补充完整。
#include <iostream.h>
class Base{
public:
【12】 fun( ){cout<<"Base::fun"<<end1:}
class Derived : public Base{
public:
【13】 fun( ){ cout<<"Derived::fun"<<end1; }
};
int main( )
{
Base a,*pb;
Derived b;
pb = &b;
pb->fun( );
return 0;
}
[填空题]下面程序的输出结果为:Base::fun,请将程序补充完整。
#include<iostream.h>
class Base{
public:
【12】 fun( ){cout<<"Base::fun"<<end1;}
};
class Derived:public Base{
public:
【13】 fun( ){cout<<"Derived::fun"<<end1;}
};
int main( )
{
Base a,*pb;
Derived b;
pb=&b;
pb->tim( );
return 0;
}
[填空题]下列程序的输出结果为:
0bject id=0
0biect id=1
请将程序补充完整。
#include<iostream>
using namespace std;
class Point
public:
Point(int xx=0,int yy=0)X=xx;Y=yy;countP++;
~Point( )countP--;
int GetX( )return X;
int GetY( )return Y;
static void GetC( )cout<<"0bject id="<<countP<<end1;
private:
int X,Y;
static int countP;
;
______//静态数据成员的初始化
int main( )
Point::GetC( );
Point A(4,5);
A.GetC( );
return 0;
[单项选择]如下程序是为变量i赋值。若程序的输出结果是180。请将程序补充完整。
注意:不改动程序结构,不得增行或删行。
class Base
int i;
Base( )
add(10);
void add(int v)
i+=v;
void print( )
System.out.println(i);
class Extension extends Base
Extension( )
add(______);
void add(int v)
i+=v*2;
public class ConstructTest3
public static void main(String args[])
bogo(new Extension( ));
static void bogo(Base b)
b.add(60);
b.print( );