LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 715|回复: 1

求教关于const成员的初始化

[复制链接]
发表于 2005-5-11 17:26:18 | 显示全部楼层 |阅读模式
class Increment{

public:
        Increment(int c=0,int i=1);

private:
        int count;
        const int increment;
}

Increment::Increment(int c,int i)
        :count(c),                                  //line 23
         increment(i)
{

}
在编译时显示错误
fig07.C:23: error: new types may not be defined in a return type
fig07.C:23: error: return type specification for constructor invalid

请问怎么回事?
发表于 2005-5-12 12:39:43 | 显示全部楼层
大哥, 你的class定义没有加上分号.
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表