菜鸟请教简单c++问题,请问如何改正?为什么?十分感谢!!!

菜鸟请教简单c++问题,请问如何改正?为什么?十分感谢!!!

图片说明

C:\Users\dell\Desktop\execisiii\0.cpp|12|error: field 'w' has incomplete type|
C:\Users\dell\Desktop\execisiii\0.cpp||In member function 'void s::set()':|
C:\Users\dell\Desktop\execisiii\0.cpp|20|error: 'w' was not declared in this scope|
C:\Users\dell\Desktop\execisiii\0.cpp|21|error: 'W' was not declared in this scope|
C:\Users\dell\Desktop\execisiii\0.cpp||In member function 'void s::show()':|
C:\Users\dell\Desktop\execisiii\0.cpp|27|error: 'w' was not declared in this scope|
||=== Build failed: 4 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|

红红火火,恍恍惚惚,看不清。但从编译结果来看,这是错误,而不是bug。

错就错在 S 这个类里面又包含了一个 S 类型的数组 S W[10], error : field 'W' has incomplete type,正如错误描述的, W 字段有一个不完整的类型,因为 W 是 S 类型的数组, 而 S 在这个时候还不是一个完整的类型,他所需要占用的内存空间还没办法确定。