I am a newbie in Go lang , I was trying to understand Go Interface by writing a simple piece of code . I am getting an error , as I am not able to understand the correct way of referring to a Interface method kindly tell me where I am going wrong.
type Info interface {
Noofchar() int
}
type Testinfo struct {
noofchar int
}
func (x Testinfo)Noofchar() int {
return x.noofchar
}
func main(){
var t Info
fmt.Println(x.Testinfo)
fmt.Println("No of char ",t.Noofchar())
x.noofchar++
fmt.Println("No of char ",t.Noofchar())
}
Am I referring to the method correctly by t.Noofchar() ? or there is something else that I am missing