Created
May 27, 2020 05:13
-
-
Save makotom/870fcc393c71729ba0bec463937fc27a 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 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