//CPerson类
class CPerson
{
protect:
CString m_strName;
UINT m_nAge;
CString m_strSex;
public:
CPerson() //默认构造函数
{
m_strName.Empty();
m_nAge = 22;
m_strSex.Empty();
}
CPerson(CString strName="",UINT nAge=22,CString strSex="") //一般构建函数
{
this->m_strName = strName;
this->m_nAge = nAge;
this->m_strSex = strSex;
}
CPerson(const CPerson& perObj) //拷贝构造函数
{
this->m_strName = perObj.m_strName;
this->m_nAge = perObj.m_nAge;
this->m_strSex = perObj.m_strSex;
}
~CPerson(){} //析构函数
CString getName() //取得名字
{
cout<
}
UINT getAge() //取得年龄
{
cout<
}
CString getSex() //取得性别
{
cout<
}
};
//学生类Student
class CStudent :public CPerson
{
private:
CString m_strSno;
public:
CStudent()
{
m_strSno.Empty();
}
CStudent(CString strSno)
{
this->m->strSno = strSno;
}
~Student(){}
CString getSno()
{
cout<
}
}