Skip to content

Commit 1c08021

Browse files
authored
Merge pull request #1 from DavidDeprost/Ch17-01-misconstructed-sentence
Update ch17-01-what-is-oo.md
2 parents 15e6bd1 + 6c15b4f commit 1c08021

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

second-edition/src/ch17-01-what-is-oo.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,12 @@ field directly, which could cause the `average` field to get out of sync. The
112112
external code to read the `average` but not modify it.
113113

114114
Because we've encapsulated the implementation details of `AveragedCollection`,
115-
we could also change aspects like using a different data structure used for the
116-
`list` to use a `HashSet` instead of a `Vec`, for instance. As long as the
117-
signatures of the `add`, `remove`, and `average` public methods stayed the same,
118-
code using `AveragedCollection` wouldn't need to change. This wouldn't
119-
necessarily be the case if we exposed `list` to external code: `HashSet` and
120-
`Vec` have different methods for adding and removing items, so the external
115+
we can easily change aspects like the data structure in the future; for
116+
instance, we could use a `HashSet` instead of a `Vec` for the `list` variable.
117+
As long as the signatures of the `add`, `remove`, and `average` public methods
118+
stay the same, code using `AveragedCollection` wouldn't need to change. This
119+
wouldn't necessarily be the case if we exposed `list` to external code: `HashSet`
120+
and `Vec` have different methods for adding and removing items, so the external
121121
code would likely have to change if it was modifying `list` directly.
122122

123123
If encapsulation is a required aspect for a language to be considered

0 commit comments

Comments
 (0)