diff options
Diffstat (limited to 'doc/tutorial.md')
| -rw-r--r-- | doc/tutorial.md | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/doc/tutorial.md b/doc/tutorial.md index 3fa53abf6b9..3e7b9400e17 100644 --- a/doc/tutorial.md +++ b/doc/tutorial.md @@ -1135,7 +1135,7 @@ can sometimes make code awkward and parenthesis-filled. ~~~ # struct Point { x: float, y: float } # enum Shape { Rectangle(Point, Point) } -# impl Shape { fn area() -> int { 0 } } +# impl Shape { fn area(&self) -> int { 0 } } let start = @Point { x: 10f, y: 20f }; let end = ~Point { x: (*start).x + 100f, y: (*start).y + 100f }; let rect = &Rectangle(*start, *end); @@ -1149,7 +1149,7 @@ dot), so in most cases, explicitly dereferencing the receiver is not necessary. ~~~ # struct Point { x: float, y: float } # enum Shape { Rectangle(Point, Point) } -# impl Shape { fn area() -> int { 0 } } +# impl Shape { fn area(&self) -> int { 0 } } let start = @Point { x: 10f, y: 20f }; let end = ~Point { x: start.x + 100f, y: start.y + 100f }; let rect = &Rectangle(*start, *end); |
