MDGSF Software Engineer

[GO] struct 组合

2017-09-27
GO

package main

import "fmt"

type s1 struct {
}

func (s *s1) prints1() {
    fmt.Println("s1 print")
}

type s2 struct {
    s1
}

func main() {
    s := &s2{}
    s.prints1()
}

weixingongzhonghao

Comments

Content