fmt.Println("Printing A") } type B struct { A } func ImpossibleLiskovSubstitution(a A) { a.Test() } func main() { a := B{} ImpossibleLiskovSubstitution(a) // Aͱͯ͠ৼΔ͑ͣɺΤϥʔͱͳΔͨΊLSPҧ͍ͯ͠Δ } Bad Code
} func (a A) Test() { fmt.Println("Printing A") } type B struct { A } func PossibleLiskovSubstitution(a tester) { a.Test() } func main() { a := B{} PossibleLiskovSubstitution(a) } Good Code