更多"补充完整下面的类定义: class XCH char*a; "的相关试题:
[填空题]补充完整下面的类定义:
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"<<end1;}};
class Derived:public Base
{
public:
void fun( ){
______//显式调用基类的fun函数
cout<<"Derived::fun"<<end1;
}
};
[填空题]将下面程序补充完整。
public class PowerCale
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 ______ (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 Base {public:void
fun( ) {cout<<"Base:: fun"<<end1; } };
class Derived: public Base {
public:
void fun( ) {
【13】 //显式调用基类的fun函数
cout<<"Derived:: fun"<<end1;
}
};
[填空题]将下面程序补充完整。
public class PowerCale {
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 ______ (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 Base{public:void fun( ){tout<<"Base::fun"<<endl;}};
class Derived:public Base
{
public:
void fun( )
{
______//显示调用基类的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;;
[填空题]请将下列类定义补充完整。
class Base(public:void fun( )cout<<"Base::fun"<<endl;;
class Derived:public Base
public:
void fun( )
______ //显式调用基类的fun函数
cout<<"Derived::fun"<<endl;
;
[填空题]补充完整下面的类定义:
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); //计算圆柱体的表面积
;