Curriculum Types & methods Methods exercise 8 · freeform
Methods
About this theme
Methods are functions with a receiver — a special argument declared before the function name: func (r Receiver) Foo() { ... }. Two flavours: value receivers (operate on a copy) and pointer receivers (operate on the original). The rule of thumb: use a pointer receiver if you'd modify the receiver, or if the receiver is large enough that copying is wasteful.