struct and method in golang code example
Example: go struct methods
type Person struct {
name string
surname string
}
func (p Person) GetName() string {
return p.name
}
func (p Person) GetSurname() string {
return p.surname
}
type Person struct {
name string
surname string
}
func (p Person) GetName() string {
return p.name
}
func (p Person) GetSurname() string {
return p.surname
}