package main
import (
"fmt2"
)
type Base struct {
i int
name string
}
func (b Base) PrintField() {
b.name = "not_go"
fmt2.Println(b.name)
}
type Base2 struct {
i int
j int
name2 string
}
func (b *Base2) PrintField2() {
b.name2 = "not_go2"
fmt2.Println(b.name2)
}
type Container struct {
*Base
Base2
}
type Container2 struct {
Container
}
func main() {
t := Container{&Base{1, "go"}, Base2{1, 1, "go2"}}
t.PrintField()
t.PrintField2()
assert(t.name == "go")
assert(t.name2 == "not_go2")
t.Base.PrintField()
t.Base2.PrintField2()
fmt2.Println("-----")
t2 := Container2{t}
t2.PrintField()
t2.PrintField2()
assert(t.name == "go")
assert(t.name2 == "not_go2")
t2.Base.PrintField()
t2.Base2.PrintField2()
fmt2.Println("-----")
p := &t
p.PrintField()
test2();
}
func test2() {
t := Container{&Base{1, "go"}, Base2{1, 1, "go2"}}
t.j = 456
assert(t.j == 456)
}