that take parameters? Is it convenience in case of interface or in general.
Like for this example: http://play.golang.org/p/Xyj8Z7Isv4
We can just live with GetValue2() method and compiler accepts t.GetValue2()
injecting t wherever it finds in function parameter at compile time and
also make decision about pass by reference or value.
type Type1 string
func (t *Type1) GetValue() string{
return fmt.Sprint("Value is ",*t)
}
func GetValue2(t *Type1) string{
return fmt.Sprint("Value is ",*t)
}
func main() {
var t Type1 = "type1val"
fmt.Println(t.GetValue()) // if we have GetValue2 only then we can make it
compile like: t.GetValue2()
fmt.Println(GetValue2(&t))
}
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.