friend ostream & operator <<(ostream &out,phone_person &obj) 中的obj是什么
classphone_person{charName[20];intnumber;public:friendclassperson;friendclassphone_li...
class phone_person
{
char Name[20];
int number;
public:
friend class person;
friend class phone_list;
phone_person(char name[20]="***",int num=0)
{}
void set();
void modify();//修改
friend ostream & operator <<(ostream &out,phone_person &obj)
{
out<<"姓名"<<obj.name<<"\t"<<"手机号"<<obj.num<<endl;
return out;
}
friend istream & operator <<(istream &in,phone_person &obj)
{
cout<<"姓名:"<<endl;
in>>obj.name;
cout<<"电话:"<<endl;
in>>obj.num;
return in;
}
}; 展开
{
char Name[20];
int number;
public:
friend class person;
friend class phone_list;
phone_person(char name[20]="***",int num=0)
{}
void set();
void modify();//修改
friend ostream & operator <<(ostream &out,phone_person &obj)
{
out<<"姓名"<<obj.name<<"\t"<<"手机号"<<obj.num<<endl;
return out;
}
friend istream & operator <<(istream &in,phone_person &obj)
{
cout<<"姓名:"<<endl;
in>>obj.name;
cout<<"电话:"<<endl;
in>>obj.num;
return in;
}
}; 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询