whatcanGOwrong
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
package main
|
||||
|
||||
// Vehicle defines the vehicle behavior
|
||||
type Vehicle interface {
|
||||
// Run vehicle can run in a speed
|
||||
Run()
|
||||
}
|
||||
|
||||
// BMWS1000RR defines the motorcycle bmw s1000rr
|
||||
type BMWS1000RR struct {
|
||||
}
|
||||
|
||||
// Run bwm s1000rr run
|
||||
func (a *BMWS1000RR) Run() {
|
||||
println("I can run at 300km/h")
|
||||
}
|
||||
|
||||
func main() {
|
||||
var vehicle Vehicle = &BMWS1000RR{}
|
||||
vehicle.Run()
|
||||
}
|
||||
Reference in New Issue
Block a user