Parametric polymorphism: Difference between revisions

Content added Content deleted
(Go solution)
m (→‎{{header|Go}}: grammar)
Line 253: Line 253:
t1 and t2 have different static types, but when they are passed to average, they are bound to parameter c, of interface type, and their static types are not visible within average.
t1 and t2 have different static types, but when they are passed to average, they are bound to parameter c, of interface type, and their static types are not visible within average.


Implementation of binaryTree and bTree is dummied, but you can see that implementation of average of binaryTree contains code specific to it's representation (left, right) and that implementation of bTree contains code specific to it's representation (buckets.)
Implementation of binaryTree and bTree is dummied, but you can see that implementation of average of binaryTree contains code specific to its representation (left, right) and that implementation of bTree contains code specific to its representation (buckets.)
<lang go>package main
<lang go>package main