作者在 2009-05-09 13:09:26 发布以下内容
#include<iostream>
using namespace std;
class actor
{private:
string _name;
bool _gender;
public:
void setname(string name,bool gender);
void say();
};
using namespace std;
class actor
{private:
string _name;
bool _gender;
public:
void setname(string name,bool gender);
void say();
};
void actor::setname (string name,bool gender)
{_name=name;
_gender=gender;
}
{_name=name;
_gender=gender;
}
void actor::say ()
{cout<<_name<<": 我乃"<<_name<<"是也"<<endl;
}
int main()
{actor tang;
tang.setname ("唐三藏",1);
tang.say ();
return 0;
{actor tang;
tang.setname ("唐三藏",1);
tang.say ();
return 0;
}