Skip to content

Commit

Permalink
improved ch07
Browse files Browse the repository at this point in the history
  • Loading branch information
pezy committed Jun 24, 2015
1 parent c638184 commit a0fea7b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions ch07/ex7_05.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
class Person {
std::string name;
std::string address;
std::string getName() const { return name; }
std::string getAddress() const { return address; }
public:
const std::string& getName() const { return name; }
const std::string& getAddress() const { return address; }
};

#endif
Expand Down
7 changes: 4 additions & 3 deletions ch07/ex7_09.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,17 @@
#include <iostream>

struct Person {
std::string getName() const { return name; }
std::string getAddress() const { return address; }
const std::string& getName() const { return name; }
const std::string& getAddress() const { return address; }

std::string name;
std::string address;
};

std::istream &read(std::istream &is, Person &person)
{
is >> person.name >> person.address;
if (!is) person = Person();
return is;
}

Expand Down

0 comments on commit a0fea7b

Please sign in to comment.