Created
January 26, 2023 07:23
-
-
Save arriqaaq/092cb40f17e35c29324399e2286ddbe5 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
type Car interface { | |
Drive() string | |
} | |
type SportsCar struct {} | |
func (s SportsCar) Drive() string { | |
return "Vroom vroom!" | |
} | |
type SUV struct {} | |
func (s SUV) Drive() string { | |
return "Rumble rumble!" | |
} | |
type CarFactory interface { | |
Create(carType string) Car | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment