在C 中的初学者,我面临此问题错误C3867
beginner in c++ and i face this problem error C3867
这是我的第一个C 项目,我遇到了这个问题错误C3867
我的main
代码是
#include <string>
#include <iostream>
#include "Car.h"
int main() {
Car c1;
c1.setMaker("Honda");
c1.setModel(2018);
cout << "This Car Made By" << c1.getMaker << "n";
cout << "This Car Model" << c1.getModel << "n";
}
标题是
#pragma once
#include <string>
using namespace std;
class Car {
private:
string maker;
int model;
public:
void setMaker(string m);
string getMaker();
void setModel(int m);
int getModel();
CPP是
#include "Car.h"
void Car::setMaker(string l) { maker = l; }
string Car::getMaker() { return maker; }
void Car::setModel(int m) { model = m; }
int Car::getModel() { return model; }
这是错误消息: error C3867: 'Car::getMaker': non-standard syntax; use '&' to create a pointer to member
我已经尝试了我作为初学者所知道的一切,但我无法使它起作用:(
您需要在最后使用参数列表调用函数,即使该列表为空。
例如
c1.getMaker
是GetMaker函数的地址
c1.getMaker()
实际上调用函数
相关文章:
- 警告处理为错误这里有什么问题
- Project Euler问题4的错误解决方案
- 静态数据成员的问题-修复链接错误会导致编译器错误
- 谷歌启动B轮巴士路线问题错误的答案?
- C++编译问题错误 - C2332:<类:缺少标记名称>
- 编译方面的问题.错误E0413、E0434、C2664、C2440
- 在C 中的初学者,我面临此问题错误C3867
- C++:创建线程时出现问题;错误 C2672:"std::invoke":找不到匹配的重载函数
- 模板方法定义的问题 - 错误C2244:无法将函数定义与现有声明匹配
- C 继承问题错误C2084功能已经具有主体
- 安装 QT 后的新手问题 - 错误:未知类型名称"QApplication"
- Stroustrup的代码审查-编程原理-Ch-4-问题:3-错误:矢量下标超出范围
- C 问题错误在此函数中被统一使用
- 返回模板类的模板函数 - GCC 编译问题 - 错误:令牌之前'<'预期非限定 ID
- CMake CLion 问题 - 错误:无法确定目标"XYZ"的链接语言
- 试图将数据写入文件时出现问题.错误LNK2019:未解析的外部符号
- c++初始化列表问题-错误:试图引用已删除的函数
- visual studio 2012 - SFGUI/ c++编译问题.错误2019:未解析的外部符号
- Makefile问题:错误127,255,在Makefile中运行程序
- 将成员函数用作操作数时出现C++问题.错误C2679