1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
#include <iostream.h> class point { public: int x; int y; void output() { cout << x << endl << y << endl; } }; void main() { point pt; pt.x = 5; pt.y = 5; pt.output(); } |
转载请注明:exchen's blog » C++ 中的结构与类可以通用