c++ - 构造函数的外联定义的返回类型与声明中的不同
问题描述
我有一个关于派生类构造函数的问题。
这是我的课 LeftV
,
class LeftV : public Body{
public:
LeftV(string o, string name, int mag, string dir, char type);
};
和实施,
LeftV::LeftV(string o, string name, int mag, string dir, char type) : Body(o, name, mag, dir){
this->type = type;
};
我收到以下错误,
“'LeftV::LeftV' 的外联定义的返回类型与声明中的不同。”
如果我声明的是构造函数,为什么它告诉我返回类型不同?
谢谢!
解决方案
推荐阅读
- json - 用 jq 过滤嵌套数组
- javascript - 如何使用 JS 'onClickEvent()' 在 HTML 中的表格上设置数字
- yaml - YAML合并2套
- python-3.x - 抓取所有 youtube 搜索结果
- python - 如何覆盖python的“不在”运算符
- c++ - Segmentation fault 调试器报错信息是什么意思?
- python - 为什么堆叠 CNN 会破坏可重复性(即使使用种子和 CPU)?
- javascript - 按每个对象数组中的值对对象数组进行排序
- systemd - systemd 上 emmc 上的 ioctl() 需要哪些功能?
- javascript - 密码字段仅在输入用户名后才显示?