c++第一个对象程序出错了帮忙看一下
#include<iostream.h>class family
{
private:
char *fname;
char *mname;
char *son;
char *girl;
family *ptr;
public:
void initfa(void);
void outfa(family *ptr);
};
family family1;
void family::outfa(family *ptr)
{
cout<<"family1的成员列表"<<endl;
cout<<"------------------------------------"<<endl;
cout<<"fname "<<ptr->fname<<endl;
cout<<"mname "<<ptr->manem<<endl;
cout<<"son "<<ptr->son<<endl;
cout<<"girl "<<ptr->girl<<endl;
cout<<"------------------------------------"<<endl;
}
void family::initfa(void)
{
family1.ptr=&family1;
family1.ptr->fname="父亲";
family1.ptr->mmane="母亲";
family1.ptr->son="儿子";
family1.ptr->girl="女儿";
family1.outfa(family1.ptr);
}
void main(void)
{
family1.initfa(void);
}
出错信息:
执行 cl.exe 时出错.
hello.exe - 1 error(s), 0 warning(s)
[[it] 本帖最后由 longxies 于 2008-2-13 21:26 编辑 [/it]]