SHOW:
|
|
- or go back to the newest paste.
1 | #ifndef PERSON_H | |
2 | #define PERSON_H | |
3 | ||
4 | ||
5 | #include <string> | |
6 | #include <iostream> | |
7 | ||
8 | ||
9 | class Person { | |
10 | public: | |
11 | // type members | |
12 | using id = std::string; | |
13 | // constructors | |
14 | Person() = default; | |
15 | Person(std::string name, std::string address); | |
16 | // interface | |
17 | void setName(id fName); | |
18 | std::string getName() const; | |
19 | void setAddress(id fAddress); | |
20 | std::string getAddress() const; | |
21 | //friends | |
22 | friend std::istream& read(std::istream& is, Person& fPerson); | |
23 | friend std::ostream& print(std::ostream& os, const Person& fPerson); | |
24 | private: | |
25 | id name = "not set"; | |
26 | id address = "not set"; | |
27 | }; | |
28 | ||
29 | ||
30 | // auxilary funcs | |
31 | std::istream& read(std::istream& is, Person& fPerson); | |
32 | std::ostream& print(std::ostream& os, const Person& fPerson); | |
33 | ||
34 | ||
35 | #endif |