#include <iostream>
#include <string>
using namespace std;
class Student
{
public:
// 存
void setname(string s){ name = s;}
void setage(int y){age = y; }
void setaddress(string add){address = add;}
// 取
string getname(){return name;}
int getage(){return age;}
string getaddress(){return address;}
Student(string name="",int age=0,string address="")
{
this->name = name; this->age = age; this->address = address;
}
~Student(){}
//重载 运算符<< : 把 "operator<<" 看作是函数名, 返回类型是 ostream类型的对象引用
friend ostream& operator<< (ostream &os,Student &st)
{
os<<st.name<<"------"<<st.age<<"------"<<st.address<<endl;
return os;
}
protected:
private:
string name;
int age;
string address;
};
void main()
{
Student x1("刘莉莉