Skip to content

Instantly share code, notes, and snippets.

@i7an
Last active November 10, 2017 12:19
Show Gist options
  • Save i7an/1c946af2076c8d7e019a433f1b973d95 to your computer and use it in GitHub Desktop.
Save i7an/1c946af2076c8d7e019a433f1b973d95 to your computer and use it in GitHub Desktop.
package main
import "fmt"
type IA interface {
methodA()
methodB()
}
type A struct {}
func (a *A) methodA() {}
func (a *A) methodB() {}
type A1 struct { IA }
func (a *A1) methodA() {}
type A2 struct { a IA }
func (a *A2) methodA() {}
func (a *A2) methodB() {}
func main() {
var a, a1, a2 IA
a = &A{}
a1 = &A1{a}
a2 = &A2{a}
fmt.Printf("hello", a, a1, a2)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment