Why does this example work?
A BVec is a kind of Vector
Calling sum(b, 20) binds v to the Vector part of b
When sum is running, it doesn’t care whether it’s working on a Vector, a BVec, or an object of some other class derived from Vector.
Previous slide
Next slide
Back to first slide
View graphic version