Skip to content

Instantly share code, notes, and snippets.

@makotom
Created May 27, 2020 05:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save makotom/870fcc393c71729ba0bec463937fc27a to your computer and use it in GitHub Desktop.
Save makotom/870fcc393c71729ba0bec463937fc27a to your computer and use it in GitHub Desktop.
package main
import "fmt"
type greeting struct {}
func (* greeting) sayHello() string {
return "Hello world!"
}
type person struct {
greeting
name string
age int
}
func main() {
p := person{ name: "hoge", age: 20};
fmt.Println(p.sayHello());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment