Skip to content

Commit 2a9b2a1

Browse files
committed
Small wording tweak, wrapping
1 parent 719e964 commit 2a9b2a1

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,14 @@ 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 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
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` field. As
117+
long as the signatures of the `add`, `remove`, and `average` public methods
118118
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
121-
code would likely have to change if it was modifying `list` directly.
119+
wouldn't necessarily be the case if we exposed `list` to external code:
120+
`HashSet` and `Vec` have different methods for adding and removing items, so
121+
the external code would likely have to change if it was modifying `list`
122+
directly.
122123

123124
If encapsulation is a required aspect for a language to be considered
124125
object-oriented, then Rust meets that requirement. Using `pub` or not for

0 commit comments

Comments
 (0)