1
2
3
4
5
6
7
8
9 package main
10
11 type T struct{ x int }
12
13 func (T) mT() {}
14
15 type S struct {
16 T
17 }
18
19 func (S) mS() {}
20
21 type P *S
22
23 type I interface {
24 mT()
25 }
26
27 func main() {
28 var s S
29 s.T.mT()
30 s.mT()
31
32 var i I
33 _ = i
34 i = s.T
35 i = s
36
37 var ps = &s
38 ps.mS()
39 ps.T.mT()
40 ps.mT()
41
42 i = ps.T
43 i = ps
44
45 var p P = ps
46 (*p).mS()
47 p.mS()
48
49 i = *p
50 i = p
51
52 p.T.mT()
53 p.mT()
54
55 i = p.T
56 i = p
57 }
58
View as plain text