diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-03-28 15:00:40 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-03-31 15:47:37 -0700 |
| commit | 37a3131640d0fa2633aa26db7f849d110250ce51 (patch) | |
| tree | 1e66451d207e19694d62608a8e1724c71796dc00 /src/doc/tutorial.md | |
| parent | 809342719541db989bee43e695f1d88b8340ac4e (diff) | |
| download | rust-37a3131640d0fa2633aa26db7f849d110250ce51.tar.gz rust-37a3131640d0fa2633aa26db7f849d110250ce51.zip | |
doc: Update with changes in field privacy
Diffstat (limited to 'src/doc/tutorial.md')
| -rw-r--r-- | src/doc/tutorial.md | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/doc/tutorial.md b/src/doc/tutorial.md index e15145e5f1d..3423a5e090e 100644 --- a/src/doc/tutorial.md +++ b/src/doc/tutorial.md @@ -2657,8 +2657,8 @@ Rust doesn't support encapsulation: both struct fields and methods can be private. But this encapsulation is at the module level, not the struct level. -For convenience, fields are _public_ by default, and can be made _private_ with -the `priv` keyword: +Fields are _private_ by default, and can be made _public_ with +the `pub` keyword: ~~~ mod farm { @@ -2667,8 +2667,8 @@ mod farm { # impl Human { pub fn rest(&self) { } } # pub fn make_me_a_farm() -> Farm { Farm { chickens: ~[], farmer: Human(0) } } pub struct Farm { - priv chickens: ~[Chicken], - farmer: Human + chickens: ~[Chicken], + pub farmer: Human } impl Farm { |
