当你写一个 含有struct的代码时,一般都是在.h文件中定义完整的struct的 结构,但是这样违背了封装的意义了。所以 一般在头文件只是给出struct的声明,定义在.cpp中;如:
a.h中:
 - typedef struct abc abc;
- abc hello();//返回值为 abc的函数
a.cpp中
 - typedef struct abc {
- int a;
- char c;
- }abc;
 - 本文出处:http://blog.163.com/redhumor@126/blog/static/19554784201262553313422/
|