Skip to content

Instantly share code, notes, and snippets.

@dojiong
Created July 27, 2013 08:51
Show Gist options
  • Save dojiong/6094284 to your computer and use it in GitHub Desktop.
Save dojiong/6094284 to your computer and use it in GitHub Desktop.
package main
import "fmt"
type Func func(int) int
func (f *Func) test(q int) int {
return (*f)(q + 1)
}
func myFunc(a int) int {
return a * a
}
func main() {
f := Func(myFunc)
fmt.Println(f.test(3))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment