关于STRING,求解C++

来源:百度知道 编辑:UC知道 时间:2024/05/25 17:35:35
#include<string>
using std::string;
namespace none
{
class Resident
{
public:
Resident(){name="NONE";number=0;day=0;month=0;}
Resident(const string& thename,int& thenumber,int& theday,int& themonth){name=thename;number=thenumber;day=theday;month=themonth;}
int getnumber(){return number;}
string getname(){return name;}
int getday(){return day;}
int getmonth(){return month;}
void setnumber(const int& thenumber){number=thenumber;}
void setname(const string& thename){name=thename;}
void setday(const int& theday){day=theday;}
void setmonth(const int& themonth){month=themonth;}
private:
int number,day,month;
string name;
};
}
#include<string>
#include"H1.H"
using std::string;
namespace none
{
class Adult:public Resident
{
public:
Adult(){Resident();job="none";grade=&quo

Adult的覆盖默认函数有问题,改成
Adult(const string& thename,int& thenumber,int& theday,int& themonth,string& thejob,string& thegrade)
:Resident(thename,thenumber,theday,themonth)
{
job=thejob;
grade=thegrade;
}

using std::string;
using std::cin;
using std::cout;
using std::endl;
using namespace none;
改为
using namespace std;
你以前学什么语言的?