Last active
March 7, 2021 12:01
-
-
Save Harsimran1/2b4410e5eaf290bd6c89693a81c71ca8 to your computer and use it in GitHub Desktop.
Golang Interface Definition Example
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
type Vehicle interface { | |
Drive() | |
} | |
// Car implements the Vehicle interface simply by implementing method Drive. | |
type Car struct{} | |
func (c Car) Drive() { | |
fmt.Println("Drive") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment