Skip to content

Commit 6f16054

Browse files
committed
ch7 updated
7_16 to 7_19
1 parent 828098d commit 6f16054

4 files changed

Lines changed: 24 additions & 0 deletions

File tree

ch7/7_16.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// the number and the position of access specifiers is not certain.
2+
// the members which you want to access at everywhere after the definition should be put after the public specifier.
3+
// the members which you want to access only at the class should be put after the private specifier.

ch7/7_17.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// The only difference between struct and class is the default access level.
2+
// struct: public
3+
// class: private

ch7/7_18.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// Encapsulation: the separation of implementation from interface. It hides the implementation details of a type.

ch7/7_19.cc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// class Person
2+
// {
3+
// public://the interface should be public
4+
// Person() = default;
5+
// Person(const string &s1, const string &s2) : name(s1), name(s2) { }
6+
// Person(std::istream &is)
7+
// {
8+
// read(is, *this);
9+
// }
10+
11+
// string getName() const { return name; }
12+
// string getAddress() const { return address; }
13+
14+
// private://the data should be private
15+
// string name;
16+
// string address;
17+
// };

0 commit comments

Comments
 (0)