bul'
This commit is contained in:
parent
ce7565827e
commit
f7fe833d3e
3
headFirst/struct/go.mod
Normal file
3
headFirst/struct/go.mod
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
module main
|
||||||
|
|
||||||
|
go 1.24.6
|
||||||
11
headFirst/struct/help/help.go
Normal file
11
headFirst/struct/help/help.go
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
package help
|
||||||
|
|
||||||
|
type Info struct {
|
||||||
|
Name string
|
||||||
|
Age int
|
||||||
|
Inner
|
||||||
|
}
|
||||||
|
|
||||||
|
type Inner struct {
|
||||||
|
Test string
|
||||||
|
}
|
||||||
19
headFirst/struct/main.go
Normal file
19
headFirst/struct/main.go
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"main/help"
|
||||||
|
)
|
||||||
|
|
||||||
|
func showStruct(p *help.Info) {
|
||||||
|
fmt.Println(p.Name)
|
||||||
|
fmt.Println(p.Age)
|
||||||
|
fmt.Println(p.Test)
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
k := help.Info{Name:"kek",Age: 19}
|
||||||
|
k.Test = "lol"
|
||||||
|
showStruct(&k)
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user