c++ beginner 的菜鸟问题
所在版块:求学狮城 发贴时间:2003-02-21 02:13

用户信息
复制本帖HTML代码
高亮: 今天贴 X 昨天贴 X 前天贴 X 
请问将program分在三个function的问题:
即: lab.cpp data.h data.cpp

为什么我用"inline"在data.cpp(implementation file)里的某些class member function 的前面,compile时就会出错呢?
但是去掉"inline"后就什么问题都没有了,program运行也很正常.
难道分成3个file就不能用"inline" function?
如果能用,用法还是和写在一个file里一样吗?

注:我所用到的inline function都是很小的class member function:
eg:
class Datalist {
..............
int getMonth() const;
..............
}

inline int Datelist::getMonth() const {
return month;
}
.
欢迎来到华新中文网,踊跃发帖是支持我们的最好方法!

Put your OWN COOL signature here!
 相关帖子 我要回复↙ ↗回到正文
c++ beginner 的菜鸟问题 如今   (514 bytes , 618reads )
i think you also have to put inline in class def 吴永铮   (279 bytes , 219reads )
Why need do this? Yup   (157 bytes , 480reads )
let me try with GCC and others. hash   (0 bytes , 168reads )
i even got problem when i try to compile 和尚庙的主持   (55 bytes , 165reads )
The use of inline, __inline, __forceinline Yup   (2160 bytes , 380reads )