You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

38 lines
463 B

package template
import "fmt"
type WorkInterface interface {
GetUp()
Work()
Sleep()
}
type Worker struct {
WorkInterface
}
func NewWorker(w WorkInterface) *Worker {
return &Worker{w}
}
func (w *Worker) Daily() {
w.GetUp()
w.Work()
w.Sleep()
}
type Coder struct {
}
func (c *Coder) GetUp() {
fmt.Println("::操作:GetUp")
}
func (c *Coder) Work() {
fmt.Println("::操作:Work")
}
func (c *Coder) Sleep() {
fmt.Println("::操作:Sleep")
}