更多"补充完整下面的类定义: const double PI=3.14;"的相关试题:
[填空题]补充完整下面的类定义:
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); //计算圆柱体的表面积
;
[填空题]补充完整下面的类定义:
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);}//计算圆柱体的表面积
};
[填空题]补充完整下面的类定义:
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;
}
};
[填空题]请将下列类定义补充完整。
class Basepublic:void fun( )cout<<"Base∷fun"<<end1;;
c1ass DehVed:public Base
public:
void fun( )
______ ∥显式调用基类的fun函数
cout<<"Derived∷fun"<<endl;
;
[填空题]类Sampie的构造函数将形参data赋值给数据成员data。请将类定义补充完整。
class Sample
public:
Sample(int data=0);
priVate:
int data:
;
Sample::Sample(int datA)
______
[填空题]请将下列类定义补充完整。
class Base {public:void
fun( ) {cout<<"Base:: fun"<<end1; } };
class Derived: public Base {
public:
void fun( ) {
【13】 //显式调用基类的fun函数
cout<<"Derived:: fun"<<end1;
}
};