阅读下列程序。如果程序中有错误,找出错误并说明错误原因;如果没有错误,写出程序的运行结果。
#include<iostream.h>
class Myclass
{ public:
Myclass ( int a )
{ cout<<a<<”constructor!”<<endl;
x=a; }
void show( Myclass my)
{ cout<<”function : x=”<<my.x<<endl; }
~Myclass( )
{ cout<<x<<”destructor!”<<endl; }
private:
int x;
};
void main( )
{ Myclass my(5);
my.show(10);
}
引号都是中文的,这算不算
5constructor!
10constructor!
function : x=10
10destructor!
5destructor!