写好了一个关于People的类然后代码没错,这个是什么错了
#include<iostream>#include<string>
using namespace std;
class Date{
public:
Date(char brithday[12])
{ cout<<"类内嵌子对象被调用"<<endl;
cout<<"brithday is"<<brithday[12]<<endl;}
};
class People{
private:
int number;
char sex[4];
char *id;
public:
Date a(char a[12]);//类内嵌子对象
People(int a,char s[4],char *i);
void print();
~People();
};
People::People(int a,char s[4],char *i)//定义了一个对象成员函数
{ number=a;
sex[4]=s[4];
id=new char [strlen(i)+1];
strcpy(id,i);
cout<<"对象成员函数被调用"<<endl;
}
void People::print(){cout<<number<<sex[4]<<*id;}
void main()
{int b;//输入编号a的值
char k[4];//性别sex
char m[12];//brithday
char l[20];//身份证ID
cin>>b;
cin>>k;
cin>>l;
cin>>m;
People(b,k,l);
Date::Date (m);
}