函数调用缺少参数列表是什么意思
#include<stdlib.h>
#include<iostream>
#include<string>
using namespace std;
class Student
{
public:
void setName(string _name)//参数的命名,这里使用下划线
{
m_strName = _name;
}
string getName()
{
return m_strName;
}
void setGender(string _gender)//参数的命名,这里使用下划线
{
m_strGender = _gender;
}
string getGender()
{
return m_strGender;
}
int getScore()//int 返回值
{
return m_iScore;
}
void initScore()//通过初始化来定义初值
{
m_iScore = 0;
}
void study(int _score)
{
m_iScore += _score;//m_Score=m_iScore+_score
}
private:
string m_strName;
string m_strGender;
int m_iScore;
};
int main(void)
{
Student stu;
stu.initScore();
stu.setName("zhangsan");
stu.setGender("女");
stu.study(5);
stu.study(3);
cout << stu.getName << " " << stu.getGender << " " << stu.getScore << endl;
system("pause");
return 0;
}
错误 2 error C3867: “Student::getName”: 函数调用缺少参数列表;请使用“&Student::getName”创建指向成员的指针 e:\vstext\text\text\text.cpp 54 1 text