但是我才学C++几天
照片贴上来看看
没有
晕啊
补什么了
人家明天就要答复了
一晚上能补出点啥
我现在连这个都没弄明白哪错了:
#include <iostream.h>
#include <string.h>
class Person
{
protected:
char m_strName[20];
int m_nAge;
int m_nSex;
public:
Person(char*name,int age,char*sex)
{
strcpy(m_strName,"李四");
m_nAge=20;
m_nSex=0;
}
~Person()
{
cout<<"deconstructor of Person"<<endl;
}
void Register(char*name,int age,char sex)
{
strcpy(m_strName,name);
m_nAge=age;
m_nSex=(sex=='m'?0:1);
}
void Showme()
{
cout<<"姓名:"<<m_strName<<endl;
cout<<"年龄:"<<m_nAge<<endl;
cout<<"性别:"<<(m_nSex==0?"男":"女")<<endl;
}
};
class Teacher:public Person
{
char m_strDept[20];
int m_nSalary;
public:
Teacher(char *name,int age,char sex,char *dept, int salary):person(name,age,sex)
{
strcpy(m_strDept,"电子高专办分室");
m_nSalary=1500;
}
~Teacher()
{
cout<<"deconstructor of Teacher"<<endl;
}
void showMe()
{
cout<<"工作单位:"<<m_strDept<<endl;
cout<<"月薪:"<<m_nSalary<<endl;
}
};
void main()
{
Teacher t1();//"张三",25,'f',"电子高专计算机系",2000);
t1.ShowMe();
}