#include "stdio.h"
#include <iostream.h>
class Location()
{
public:
Location(int xx=0,int yy=0);
Location(Location & p);
~Location();
int GetX(){return X;}
int GetY(){return Y;}
private:
int X,Y;
};
Location::Location(int xx,int yy)
{
X=xx;
Y=yy;
cout<<"constructor Object.\n";
}
Location::~Location()
{
cout<<X<<","<<Y<<"objiect destroyed."<<endl;
}
Location::Location(Location & p)
{
X=p.X;
Y=p.Y;
cout<<"copy constructor called.\n";
}
void f(Location p)
{
cout<<"Function"<<p.GetX()<<","<<p.GetY()<<endl;
}
void main()
{
Location B(1,2);
f(B);
}
这个程序应该没问题吧.怎么通不过编译?
王高手指点!