package playimport ("fmt""time")type MP3Player struct {stat intprogress int}func (p *MP3Player)Play(source ,name string) {fmt.Printf("\nPlaying %s MP3 music from %s\n",name,source)p.progress =0for p.progress <100{time.Sleep(100*time.Millisecond) //假装正在播放fmt.Printf("the music %s playing\n",name)p.progress +=10}fmt.Printf("\nFinish Playing %s from %s\n",name,source)}
