Add "override" and/or "final" to member functions where appropriate.

The more important of these is "override", so that the C++ compiler will
check whether we are indeed overriding an inherited member function as we
think we are.  Adding "final" gives some optimization benefit in theory,
though in practice that's really not a concern for us here.