C++中有两个文件:xt8-4.h和xt8-4.cpp 具体代码见问题补充,在VC++6.0中如何实现运行 我希望具体的步骤

2024-12-28 02:38:02
推荐回答(1个)
回答1:

#include
// using namespace std; // MS VC++ comment out the line
#include "point.h"
#include "point.cpp"

void main(){
Point A(4,5);
cout<<"Point A,"<A.getc();
Point B(A);
cout<<"Point B,"<Point::getc();
}
--------------------------------------------
// point.cpp
int Point::count=0;
Point::Point(Point &p){
X=p.X;Y=p.Y;count++;}
----------------------------------
// point.h
class Point{
public:Point(int xx=0,int yy=0)
Point(Point &p);
~Point()
int getx()
int gety()
static void getc()
private:int X,Y;
static int count;
};
---------------------------

MS VC++ 编译通过。