init commit

This commit is contained in:
2024-03-19 01:05:51 +08:00
commit 199bbf2628
393 changed files with 34883 additions and 0 deletions

36
archive/go/class/class.go Normal file
View File

@ -0,0 +1,36 @@
package main
import "fmt"
type IA interface {
FuncA()
FuncB()
}
type A struct {
IA
}
func (a *A) FuncA() {
fmt.Println("class a,func a")
}
type B struct {
}
func (b *B) FuncA() {
fmt.Println("class b,func a")
}
func (b *B) FuncB() {
fmt.Println("class b,func b")
}
func main() {
var a IA = new(A)
a.FuncA()
// a.FuncB() //报错的
var a2 IA = &A{IA: new(B)}
a2.FuncA()
a2.FuncB()
}