< Programmeren in Go

Programmeren in Go

Commentaar
Pakketten
Variabelen en constanten
Assignments
For
Switch
Functies
Defer
Arrays
Slices
Methodes
Types
Goroutines
Channels
Select

Methodes zijn in Go niks anders dan functies met een ontvanger. De ontvanger komt voor de naam van de functie.

func (o *ObjectType) FunctieNaam() (aanroep int) returnwaarde int {
}
// Dus
func (v *Vector2D) Optellen(w *Vector2D) {
    v.x = v.x + w.x
    v.y = v.y + w.y
}
This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.