I have interface that requires its implementor to have Click method. However, the type FakeTicker that implements this interface also implements Tick method in addition to Click method.
package main
type Ticker interface{
Click() string
}
type FakeTicker struct{
val string }
func (f FakeTicker) Click() string {
return f.val
}
func (f FakeTicker) Tick() int { return 1 }
func main() {
var clocker Ticker
clocker = FakeTicker{"Val"}
clocker.Tick()
}
Here I get the following error "clocker.Tick undefined (type Ticker has no field or method Tick)"
I understand that the interface only has method Click() but since FakeWriter is implementing the interface, Shouldn't it be able to call its own method Tick()?