-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathembedding.go
More file actions
65 lines (53 loc) · 760 Bytes
/
embedding.go
File metadata and controls
65 lines (53 loc) · 760 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package main
import (
"fmt"
)
// Person is a strcut for person object
type Person struct {
Fname string
Lname string
Address
}
type Address struct {
addr string
city string
state string
}
func (a *Address) Foo() {
a.addr = "q"
}
func (p *Person) Foo() {
p.Address.addr = "w"
}
type A struct {
ParamA1 int16
ParamA2 string
}
type B struct {
A
ParamB1 int16
ParamB2 string
}
func main() {
p := Person{}
p.Fname = "Maxim"
p.Lname = "Tishchenko"
p.Address.addr = "Marksa ave"
fmt.Println(p.Address.addr)
p.Foo()
fmt.Println(p.Address.addr)
a := A{
ParamA1: 1,
ParamA2: "1",
}
b := B{
A: A{
ParamA1: 2,
ParamA2: "2",
},
ParamB1: 3,
ParamB2: "4",
}
fmt.Printf("a => %#v\n", a)
fmt.Printf("b => %#v\n", b)
}