注意:此页面搜索的是所有试题
题目内容
(许昌学院面向对象程序设计)
[应用题,25分] #include
class Cdate
{
int day,month,year;
public:
Cdate ()
{
day=1;
month=1;
year=1999;
cout<<"default constructing\n";}
Cdate (int d,int m,int y)
{
day=d;
month=m;
year=y;
cout<<"constructing\n";
}
~ Cdate (){cout<<"destructing"<<><"><><><>void print( )
{cout<<><"><><>};
void main()
{ Cdate a1,*a2;
a2=new Cdate (30,12,1996);
a1.print();
a2->print();
delete a2;
}
运行结果是:
<"><">
class Cdate
{
int day,month,year;
public:
Cdate ()
{
day=1;
month=1;
year=1999;
cout<<"default constructing\n";}
Cdate (int d,int m,int y)
{
day=d;
month=m;
year=y;
cout<<"constructing\n";
}
~ Cdate (){cout<<"destructing"<<><"><><><>void print( )
{cout<<><"><><>};
void main()
{ Cdate a1,*a2;
a2=new Cdate (30,12,1996);
a1.print();
a2->print();
delete a2;
}
运行结果是:
<"><">
参考答案