This commit is contained in:
2024-08-01 23:40:06 +08:00
commit 1adca2ffe6
17 changed files with 469 additions and 0 deletions

34
main/p1.go Normal file
View File

@@ -0,0 +1,34 @@
package main
import "fmt"
type Student struct {
Name string
}
// 函数
func mthod(s Student) {
fmt.Println(s.Name)
}
func mthod1(s *Student) {
fmt.Println((*s).Name)
}
func (s *Student) test02() {
fmt.Println(s.Name)
}
func main() {
var stu = Student{"笑傲"}
mthod(stu)
mthod1(&stu)
(&stu).test02()
var s = Student{
Name: "xio",
}
fmt.Println(s)
var s3 *student = &student{
age: 19,
}
fmt.Println(s3)
}