struct B : public A
{
#define iHomeWorkJob iCount
int iOtherJob;
}
除了定义宏,还有别的办法吗?
...全文
6413打赏收藏
结构体成员起别名
struct A { int iCount; char chrType; } 最初定义了一个结构体,也在别的地方用了好多了,现在要多添加了一些成员变量,添加了之后,可能命名需要更清晰地表达变量的含义, 比如现在这个结构体A,再添加一个int 成员, struct B : public A { #define iHomeWorkJob iCount int iOtherJob; } 除了定义宏,还有别的办法吗?