cout<<stu.getName()<<" "<<stu.getGender<<" "<<stu.getScore()<<endl;这里 把stu.getGender删去就可运行,加上却说缺少参数列表,怎么破??
#include<iostream>
#include<stdlib.h>
#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()
{
return m_iScore;
}
void intScore()
{
m_iScore=0;
}
void study(int score)
{
m_iScore+=score;
}
private:
string m_strName;
string m_strGender;
int m_iScore;
};
int main()
{
Student stu;
stu.intScore();
stu.setName("Zhangs");
stu.setGender("女");
stu.study(5);
stu.study(3);
cout<<stu.getName()<<" "<<stu.getGender<<" "<<stu.getScore()<<endl;
system("pause");
return 0;
}