Last active
November 10, 2017 12:19
-
-
Save i7an/1c946af2076c8d7e019a433f1b973d95 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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