diff options
| author | Andrew Gerrand <adg@golang.org> | 2016-02-26 15:23:49 +1100 |
|---|---|---|
| committer | Andrew Gerrand <adg@golang.org> | 2016-02-29 03:05:54 +0000 |
| commit | 1e3079b1a244b46600a08ef88beb5bc0634d18da (patch) | |
| tree | bcb3627825bfde113fdb8848ab78665184a80ddc /content/moretypes.article | |
| parent | 9616eac69404c8d4aab36bf42624b08e2e8dffd2 (diff) | |
| download | golang-id-tour-1e3079b1a244b46600a08ef88beb5bc0634d18da.tar.xz | |
moretypes: explain pointer indirection
Fixes golang/go#14040
Change-Id: I377207e2ce3f41736368a5fbd4ba11bbf2e098da
Reviewed-on: https://go-review.googlesource.com/19941
Reviewed-by: Francesc Campoy Flores <campoy@golang.org>
Diffstat (limited to 'content/moretypes.article')
| -rw-r--r-- | content/moretypes.article | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/content/moretypes.article b/content/moretypes.article index 904a578..958d496 100644 --- a/content/moretypes.article +++ b/content/moretypes.article @@ -47,7 +47,10 @@ Struct fields are accessed using a dot. Struct fields can be accessed through a struct pointer. -The indirection through the pointer is transparent. +To access the field `X` of a structwhen we have the struct pointer `p` we could +write `(*p).X`. +However, that notation is cumbersome, so the language permits us instead to +write just `p.X`, without the explicit dereference. .play moretypes/struct-pointers.go |
