求助!类问题。
各位好: 请帮我看看下面的程序叫不叫类程序:
#include<iostream.h>
#include<conio.h>
class family
{
private:
char *husband;
char *wife;
char *son;
char *daughter;
family *ptr;
public:
void Init(void);
void Output(class family *ptr);
};
family Anderson;
int main(void)
{
Anderson.Init();
getch();
return 0;
}
void family :: Init(void)
{
ptr=&Anderson;
ptr->husband="husband";
ptr->wife="wife";
ptr->son="son";
ptr->daughter="daughter";
Anderson.Output(ptr);
}
void family :: Output(class family *ptr)
{
cout<<"Anderson.husband="<<ptr->husband<<endl;
cout<<"Anderson.wife="<<ptr->wife<<endl;
cout<<"Anderson.son="<<ptr->son<<endl;
cout<<"Anderson.daughter="<<ptr->daughter<<endl;
}
谢谢!