标签:nbsp private har get 友元函数 getchar [] ret std
#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 void print(node_s &p);
};
void print(node_s &p)
{
printf("p.x: %d, p.y: %d\n", p.x, p.y);
}
int main(int argc, char* argv[])
{
node_s node(1, 2);
print(node);
getchar();
return 0;
}
标签:nbsp private har get 友元函数 getchar [] ret std
原文地址:http://www.cnblogs.com/roadmap99/p/6771386.html