#includeusing namespace std; class Node{ public: void set_x(int x); void set_y(int y); public: int x; int y; }; void Node::set_x(int x){ this->x = x; }; void Node::set_y(int y){ this->y = y; }; int main() { Node n; n.set_x(5); n.set_y(6); cout << n.x << ' ' << n.y << endl; return 0; }
运行结果:
5 6



