classPerson{public:friend istream &read(istream &is, Person &person);friend ostream &print(ostream &os,const Person &person);Person()=default;Person(const string &name,const string &address):_name(name),_address(address){}const string &name()const{return _name;}const string &address()const{return _address;}private:
string _name;
string _address;};
istream &read(istream &is, Person &person){
is >> person._name >> person._address;return is;}
ostream &print(ostream &os,const Person &person){
os << person._name << person._address;return os;}
练习7.58
classExample{public:// ‘constexpr’ needed for in-class initialization of static data member ‘double Example::rate’ of non-integral type [-fpermissive]staticdouble rate =6.5;// errorstaticconstint vecSize =20;static vector<double>vec(vecSize);}double Example::rate;// ‘std::vector<double> Example::vec’ is not a static data member of ‘class Example’
vector<double> Example::vec;// error