题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2024-02-03 00:11:16

[填空题]

补充完整下面的类定义:
class XCH{
char*a;
public:
XCH(char*aa){ //构造函数
a=new char[strlen(aa)+1];
strcpy(a,aa);
}
XCH& operator=(const XCH& x){ //重载赋值函数
delete[]a;
a=new char[strlen(x,a)+1];
strcpy(a,x,a);
______;
}
~XCH( ){delete[]a;)
}


更多"补充完整下面的类定义: class XCH{ char*a; publ"的相关试题:

[填空题]补充完整下面的类定义: class XCH{ char*a; public: XCH(char*a A) { //构造函数 a=new char[strlen(aA) +1]; strcpy(a,aA) ; } XCH&operator=(const XCH&x){//重载赋值函数 delete[ ]a; a=new char[strlen(x.A) +1]; strcpy(a,x.A) ; ______; } ~XCH( ){delete[ ]a;} };
[填空题]请将下列类定义补充完整。 class Base{public:void fun( ){cout<<"Base::fun"<<end;}}; class Derived:public Base { public: void fun( ) { 【13】 //显式调用基类的fun函数 cout<<"Derived::fun"<<endl; } };
[填空题]请将下列类定义补充完整。
class Base public: void fun( )cout<<"Base::fun"<<end1; ;
class Derived:public Basepublic:
void fun( ) 【15】 //显式调用基类的fun函数
cout<<"Derived:: fun"<<end1;;
[填空题]

请将下面程序补充完整。
public class PowerCalc{
public static void main(String[]args){
double x=5.0;
System. out. println(x+"to the power 4 is"+power(x, 4));
System. out. println("7. 5 to the power 5 is"+power(7.5, 5));
System. out. println("7.5 to the power 0 is"+power(7.5, 0));
System. out. println("10 to the power -2 is"+power(10, -2));
}
static double 【11】 (double x, int n){
if(n>1)
return x * power(x, n-1);
else if(n<0)
return 1.0/power(x, -n);
else
return n==0 1.0:x;
}
}


[单项选择]有如下类定义:
class A
char *a;
public:
A. )。 Dew char[strlen(aa)+1]
B. char[strlen(aa)+1]
C. char[strlen(aa)]D) Dew char[sizeof(aa)-1]
[单项选择]有如下类定义:

class A

char*a;

public:

A( ):a(0)

A(char*aa)//把aa所指字符串拷贝到a所指向的存储空间

a=______;

strcpy(a,aa);



~A( )delete[]a;

;

横线处应填写的表达式是
A. new char[strlen(aa)+1]
B. char[strlen(aa)+1]
C. char[strlen(aa)]
D. new char[sizeof(aa)-1]
[填空题]补充完整下面的类定义: const double PI=3.14; class Circle{ //圆形物体的抽象基类 protected: double r; //半径 public: Circle(double radius=0):r(radius){ } ______; //计算圆形物体表面积的纯虚函数声明 }; class Cylinder:public Circle{//圆柱体类 double h; //高度 public: Cylinder(double radius=0,double height=0); Circle(radius),h(height){ } Virtual double Area( ){return 2*PI*r*(r+h);}//计算圆柱体的表面积 };
[填空题]补充完整下面的类定义:
const double PI=3.14;
class Circle //圆形物体的抽象基类
protected:
double r; //半径
public:
Circle(double radius=0):r(radius)
(13) ; //计算圆形物体表面积的纯虚函数声明

class Cylinder:public Circle //圆柱体类
double h; //高度
public:
Cylinder(double radius=0,double height=0);
Circle(radius),h(height)
Virtual double Area( )return 2*PI*r*(r+h); //计算圆柱体的表面积

[填空题]下列是一个类的定义程序段,请补充完整。    public class My Class {    int x,y;   MyClass(int i,【 】) {      x=i;y=j;     }    }
[填空题]

补充完整下面的类定义:
const double PI=3.14;
class circle{ //圆形物体的抽象基类
protected:
double r; //半径
public:
Circle(double radius=0):r(radius){}
______; //计算圆形物体表面积的纯虚函数声明
};
class Cylinder: public Circle { //圆柱体类
double h;//高度
public:
Cylinder(double radius=0,double height=0):
Circle(radius),h(height){}
virtual double Area( ){ //计算圆柱体的表面积
return 2*PI*r*(r+h);
}
};


[填空题]请将程序补充完整。 import java.awt.*; public class FirstFrame extends Frame { public static void main(String args[]){ FirstFrame fr=new FirstFrame("First container!"); fr.setSize(240,240); fr. setBackground(Color.yellow); 【15】 } public FirstFrame(String str){ super(str); } }
[填空题]请将程序补充完整。
import java.awt.*;
public class FirstFrame extends Frame
public static void main(String args[])
FirstFrame fr=new FirstFrame("First container!");
fr.setSize(240,240);
fr.setBackground(Color.yellow);
【15】

public FirstFrame(Strings str)
super[str);

)
[填空题]请将程序补充完整。
import java.awt.*;
public class FirstFrame extends Frame
public static void main(String args[])
FirstFrame fr = new FirstFrame("First container!");
fr. setSize(240,240);
fr. setB ackground(Color, yellow);
【15】

public FirstFrame(String str)
super(str);


我来回答:

购买搜题卡查看答案
[会员特权] 开通VIP, 查看 全部题目答案
[会员特权] 享免全部广告特权
推荐91天
¥36.8
¥80元
31天
¥20.8
¥40元
365天
¥88.8
¥188元
请选择支付方式
  • 微信支付
  • 支付宝支付
点击支付即表示同意并接受了《购买须知》
立即支付 系统将自动为您注册账号
请使用微信扫码支付

订单号:

截图扫码使用小程序[完全免费查看答案]
请不要关闭本页面,支付完成后请点击【支付完成】按钮
恭喜您,购买搜题卡成功
重要提示:请拍照或截图保存账号密码!
我要搜题网官网:https://www.woyaosouti.com
我已记住账号密码