请教一个C++程序输出的结果,本人初学者,谢谢!

来源:百度知道 编辑:UC知道 时间:2024/04/30 18:12:20
#include <iostream.h>
class Point
{
private:
int X,Y;
public:
Point(int a=0, int b=0) {X=a; Y=b;cout<<”constructor X=”<<X<<”,Y=”<<Y;}
Point(Point &p);
void Show(){cout<<"X="<<X<<",Y="<<Y<<endl;}
~Point(){cout<<”destructor X=”<<X<<”,Y=”<<Y<<endl;}
};
Point::Point(Point &p)
{ X=p.X; Y=p.Y;
cout<<”Copy of Constructor”<<endl;
}
void display(Point p)
{
cout<<”display with object”<<endl;
}
void disp(Point& p)
{
cout<<”display with reference”<<endl;
}
Point fun()
{
Point A(15,16);
return A;
}

void main

constructor X=5,Y=6Copy of Constructor
constructor X=7,Y=8Copy of Constructor
display with object
constructor X=15,Y=16Copy of Constructor
display with reference

你下载个vc 6.0,用那个多实践一下,学习会进步很快的。
你的这个程序有很多的错误,自己学习一下吧