ARTS-S golang定义类
package main
import "fmt"
type Student struct {
Num int64
Name string
}
func(s *Student) setName(name string) {
s.Name = name
}
func(s *Student) setNum(num int64) {
s.Num = num
}
func(s *Student) getName() string {
return s.Name
}
func(s *Student) getNum() int64 {
return s.Num
}
func main() {
s := Student{}
s.setName("张三")
s.setNum(123)
fmt.Println(s.getName())
fmt.Println(s.getNum())
}