#include<iostream>
using namespace std;
class A
class B
{
private:
int x,y;
public:
void point(A &one,int z);
B(int a=0,int b=0)
{
x=a;
y=b;
}
void put()
{cout<<x<<","<<y<<endl;}
};
class A
{
private:
int c,d;
public:
A(int e=0,int f=0)
{
c=e;
d=f;
}
friend void B::point(A &one,int z);
void put()
{cout<<c<<","<<d<<endl;}
};
void B::point(A &one,int z)
{
x+=z;
y+=z;
one.c+=z;
one.d+=z;
}
int main()
{
B pt(1,2);
A pt1;
pt.put();
pt.point(pt1,3);
pt.put();
pt1.put();
return 0;
}
起始第3行处,class A 声明的最后缺了 ’;‘ ,修改如下:class A;