Polymorphic copy: Difference between revisions
→{{header|Go}}: small update for library change
(→{{header|Go}}: small update for library change) |
|||
Line 659:
i1, i2, i3 = t1, s1, r1
fmt.Println("\nPolymorphic:")
fmt.Println("i1:", i1, "/", i1.identify(), "/", reflect.
fmt.Println("i2:", i2, "/", i2.identify(), "/", reflect.
fmt.Println("i3:", i3, "/", i3.identify(), "/", reflect.
// copy: declare and assign in one step using "short declaration."
Line 672:
// and that types are preserved.
fmt.Println("\nFirst set now modified:")
fmt.Println("i1:", i1, "/", i1.identify(), "/", reflect.
fmt.Println("i2:", i2, "/", i2.identify(), "/", reflect.
fmt.Println("i3:", i3, "/", i3.identify(), "/", reflect.
fmt.Println("\nCopies made before modifications:")
fmt.Println("i1c:", i1c, "/", i1c.identify(), "/", reflect.
fmt.Println("i2c:", i2c, "/", i2c.identify(), "/", reflect.
fmt.Println("i3c:", i3c, "/", i3c.identify(), "/", reflect.
}</lang>
Output:
|