Skip to content

Instantly share code, notes, and snippets.

@l4u
Last active August 6, 2020 09:34
Show Gist options
  • Save l4u/d972d326d0ef6598a212be48a284a687 to your computer and use it in GitHub Desktop.
Save l4u/d972d326d0ef6598a212be48a284a687 to your computer and use it in GitHub Desktop.
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