Go Methods
Jump to navigation
Jump to search
Internal
Overview
Go allows associating arbitrary behavior with built-in or custom types, which contributes to the object-oriented character of the language. Note that Go is not a fully object-oriented language, it misses type inheritance, for example.
Syntactically, the association of behavior with a type is done by declaring a function (the behavior) and adding to it a receiver type (the type).
func (t T) FunctionName(parameters) (return type){
...
}