#include <stdio.h>
struct node_s {
private:
int x;
int y;
public:
node_s(int x, int y)
{
this->x = x;
this->y = y;
}
friend struct node_s1;
};
struct node_s1 {
private:
int a;
int b;
public:
node_s1(int a, int b)
{
this->a = a;
this->b = b;
}
void print(node_s &node)
{
printf("node: node.x: %d, node.y: %d\n", node.x, node.y);
}
};
int main(int argc, char* argv[])
{
node_s node(1, 2);
node_s1 node1(3, 4);
node1.print(node);
getchar();
return 0;
}
时间: 2024-10-10 01:56:06