Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import "fmt"
- func main() {
- a := A{}
- a.N = "hello"
- fmt.Println(a.Method.O("world"))
- fmt.Println(a.Method.I("whatup!"))
- fmt.Println(a.Method.F("wtf?"))
- }
- type A struct {
- N string
- Method methods
- }
- type methods struct{}
- func (m methods) O(x string) string { return fmt.Sprintf("%s_O", x) }
- func (m methods) I(x string) string { return fmt.Sprintf("%s_I", x) }
- func (m methods) F(x string) string { return fmt.Sprintf("%s_F", x) }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement