Skip to content

Commit c97126f

Browse files
JesseJesse
authored andcommitted
point parameter
1 parent fe554a4 commit c97126f

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

examples/interface/main.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,19 @@ type Human struct {
1010
firstName, lastName string
1111
}
1212

13+
type Plane struct {
14+
vendor string
15+
model string
16+
}
17+
1318
func (h *Human) getName() string {
1419
return h.firstName + "," + h.lastName
1520
}
1621

22+
func (p Plane) getName() string {
23+
return fmt.Sprintf("vendor: %s, model: %s", p.vendor, p.model)
24+
}
25+
1726
type Car struct {
1827
factory, model string
1928
}
@@ -35,4 +44,8 @@ func main() {
3544
for _, f := range interfaces {
3645
fmt.Println(f.getName())
3746
}
47+
p := Plane{}
48+
p.vendor = "testVendor"
49+
p.model = "testModel"
50+
fmt.Println(p.getName())
3851
}

0 commit comments

Comments
 (0)