line Person::Person(istream &is) { read(is, *this); } /******************************END************************************/ #endif /* PERSON_H_ */
/*********************************************************************
* file_name: Person.cpp
*
* Created on: 2014年6月28日 下午10:55:32
* Author: The_Third_Wave, Blog: http://blog.csdn.net/zhanh1218
* Email: zhanh121823@sina.com
* Last modified: 2014年6月28日 下午10:55:32
*********************************************************************/
#include
#include
#include "Person.h" using namespace std; istream &read(istream &is, Person &item) { is >> item.name >> item.age >> item.address; return is; } ostream &print(ostream &os, const Person &item) { os << item.name << " " << item.age << " " << item.address << endl; return os; }
还有不懂的请留言。
本文由@The_Third_Wave(Blog地址:http://blog.csdn.net/zhanh1218)原创。还有未涉及的,会不定期更新,有错误请指正。
如果你看到这篇博文时发现没有不完整,那是我为防止爬虫先发布一半的原因,请看原作者Blog。
如果这篇博文对您有帮助,为了好的网络环境,不建议转载,建议收藏!如果您一定要转载,请带上后缀和本文地址。