Last active
January 16, 2020 01:13
-
-
Save monkrus/976f858101c25b8aa29ae86ad67b8090 to your computer and use it in GitHub Desktop.
Go lang composition
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" | |
| ) | |
| func main() { | |
| b := Bird{} | |
| b.Gender ="male" | |
| b.Name = "Emu" | |
| b.Origin = "Australia" | |
| b.SpeedKPH = 48 | |
| b.CanFly = false | |
| fmt.Println(b.Name, b.Gender) | |
| } | |
| type Animal struct { | |
| Name string | |
| Origin string | |
| } | |
| type Bird struct { | |
| Animal | |
| SpeedKPH float32 | |
| CanFly bool | |
| Gender string | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment