Update interfaces.go

This commit is contained in:
无闻
2017-06-05 01:43:42 -04:00
committed by GitHub
parent 46db632865
commit 6665c8f914

View File

@@ -19,12 +19,12 @@ func main() {
sq1 := new(Square) sq1 := new(Square)
sq1.side = 5 sq1.side = 5
// var areaIntf Shaper var areaIntf Shaper
// areaIntf = sq1 areaIntf = sq1
// shorter, without separate declaration: // shorter, without separate declaration:
// areaIntf := Shaper(sq1) // areaIntf := Shaper(sq1)
// or even: // or even:
areaIntf := sq1 // areaIntf := sq1
fmt.Printf("The square has area: %f\n", areaIntf.Area()) fmt.Printf("The square has area: %f\n", areaIntf.Area())
} }