typedef int (*pFunc)(char *host, short port);
typedef struct {
int x;
int y;
pFunc func;
};
int func(char *host, short port) {
//怎么访问结构体中的x,y
return 0;
}
问题: func函数有没有什么方法访问结构体中x和y, 类似访问class中的成员变量?
...全文
1664打赏收藏
struct 模拟 class出现的问题
typedef int (*pFunc)(char *host, short port); typedef struct { int x; int y; pFunc func; }; int func(char *host, short port) { //怎么访问结构体中的x,y return 0; } 问题: func函数有没有什么方法访问结构体中x和y, 类似访问class中的成员变量?