源程序:

#include <iostream>
using namespace std;

class Aton
{
public:
int X, Y;
int zx, zy;
void init(int i, int j)
{
zx = i;
zy = j;
}
Aton(int i, int j, int n = 0, int m = 0)
{
X = i;
Y = j;
zx = m;
zy = n;
}
};
int main()
{
Aton A(25, 20, 3, 5);
A.init(5, 9);
cout << A.zx << A.zy << endl;
system("pause");
return 1;
}

运行结果:

自考新教材-p144_3_ios