Last active
August 6, 2020 09:34
-
-
Save l4u/d972d326d0ef6598a212be48a284a687 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Foo struct { | |
} | |
func (f Foo) foo() { | |
fmt.Println("foo") | |
} | |
type Bar struct { | |
} | |
func (b Bar) bar() { | |
fmt.Println("bar") | |
} | |
type A struct { | |
Foo | |
} | |
type B struct { | |
Foo | |
Bar | |
} | |
type AB struct { | |
A | |
B | |
} | |
func main() { | |
a := A{} | |
a.foo() | |
a.Foo.foo() | |
b := B{} | |
b.foo() | |
b.bar() | |
ab := AB{} | |
ab.B.foo() | |
ab.bar() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment