方法值和方法表达式
作者:互联网
main Student { name string age int sex string } (s *Student) SetName(name string) { s.name == name { fmt.Println() } { s.name = name fmt.Println() } } (s *Student) GetName() string { s.name } main(){ S1 := &Student{,,} A:=S1.SetName A() B := (*Student).SetName B(S1,) fmt.Println(S1.GetName()) }
标签:string,SetName,S1,Student,Println,方法,表达式,name 来源: https://blog.51cto.com/dellinger/2448228