From a 3rd party:
package lib
type Bar interface{
Age() int
}
Foo(b Bar) int
This doesn't compile because Age is both a method name and field name:
package main
import "lib"
type Person struct {
Age int
}
func (p *Person)Age() int {
return p.Age
}
func main() {
p := Person()
lib.Foo(p)
}
Without renaming Person.Age, is there a way to call lib.Foo() on an instance of Person?
Agemethod to satisfy the interface.