whatcanGOwrong

This commit is contained in:
2024-09-19 21:38:24 -04:00
commit d0ae4d841d
17908 changed files with 4096831 additions and 0 deletions
@@ -0,0 +1,31 @@
package main
import "fmt"
type A struct {
a int
}
type B struct {
*A
}
type Iface interface {
PtrReceiver() string
NonPtrReceiver() string
}
func (*A) PtrReceiver() string {
return "blah"
}
func (A) NonPtrReceiver() string {
return "blah"
}
func main() {
var iface Iface = &B{&A{1}}
s := iface.PtrReceiver()
s = iface.NonPtrReceiver()
fmt.Printf("%s\n", s)
}