i think you also have to put inline in class def
登录 | 论坛导航 -> 华新鲜事 -> 求学狮城 | 本帖共有 1 楼,分 1 页, 当前显示第 1 页 : 本帖树形列表 : 刷新 : 返回上一页
<<始页  [1]  末页>>
作者:吴永铮 (等级:8 - 融会贯通,发帖:2078) 发表:2003-02-21 12:19:28  楼主  关注此帖评分:
c++ beginner 的菜鸟问题请问将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; }
i think you also have to put inline in class def
class Datalist {
..............
inline int getMonth() const;
..............
}

but normally if I have simple function and want to make it inline.
I prefer write mathod body in class def
class Datalist {
..............
inline int getMonth() const {return month;}
..............
}
Put your OWN COOL signature here!
欢迎来到华新中文网,踊跃发帖是支持我们的最好方法!原文 / 传统版 / WAP版所有回复从这里展开收起列表
论坛导航 -> 华新鲜事 -> 求学狮城 | 返回上一页 | 本主题共有 1 篇文章,分 1 页, 当前显示第 1 页 | 回到顶部
<<始页  [1]  末页>>

请登录后回复:帐号   密码