Go语言 之多重继承

package main

import (
    "fmt"
)

type Person03 struct {
    id int
}

type Student03 struct {
    Person03
    name  string
    score float64
}

type Teacher03 struct {
    Person03
    name string
}

//Student03与Teacher03都继承于Person03
func main() {
    var s Student03 = Student03{Person03{1}, "yy", 80}

    fmt.Println(s)
}

 

posted @ 2019-06-29 10:07  样子2018  阅读(179)  评论(0编辑  收藏  举报