Created
January 27, 2022 19:39
-
-
Save percybolmer/75d2ee47669785eea781798ae5b64ee5 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
| // Person is a struct that accepts a type definition at initialization | |
| // And uses that Type as the data type for meters as input | |
| func (p Person[S]) Move(meters S) { | |
| fmt.Printf("%s moved %d meters\n", p.Name, meters) | |
| } | |
| func (c Car[S]) Move(meters S) { | |
| fmt.Printf("%s moved %d meters\n", c.Name, meters) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment