中是否可以在主体中声明

中是否可以在主体中声明

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center
                            
                        
                    
                
                                已关闭8年。
            
                    
在C ++中是否可以在主体中声明服装,即.cpp文件?

最佳答案

如果用attribute表示类的member variable,则答案是:“成员变量必须在类定义中定义。”不能在构造函数或任何成员函数中的任何其他地方定义它们。

类定义是放在头文件中还是在源(.cpp)文件中都无关紧要。

关于c++ - 在C++中是否可以在主体中声明属性? ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/7501002/

10-12 16:19