26 lines
259 B
Go
26 lines
259 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
)
|
|
|
|
var _ = (HelloInterface)((*Hello)(nil))
|
|
|
|
type HelloInterface interface {
|
|
Hi() string
|
|
}
|
|
|
|
type Hello struct{}
|
|
|
|
func (h *Hello) Hi() string {
|
|
return "hi"
|
|
}
|
|
|
|
func main() {
|
|
h := &Hello{}
|
|
fmt.Println(h.Hi())
|
|
}
|
|
|
|
// Output:
|
|
// hi
|