package main
import (
"fmt"
)
func myFunc(abx interface{}){
fmt.Println("my func is called")
fmt.Println(abx)//这个abx 可以随便换
//类型断言机制
value,ok:=abx.(string)
if !ok{
fmt.Println("abx is not string")
}else{
fmt.Println("abx is string,value=",value)
}
}
type Student struct {
name string
}
func main() {
stu:=Student{"jiaqiang"}
myFunc(stu)
myFunc(100)
myFunc(31.4)
}