Only if the called member function is a final member function. If D::f() calls this->g(), full qualification (for example, this->D::g()) should be used only if D::g() is a final member function or D is a final class. class B { public: virtual void f() throw() = 0; virtual void g() throw() = 0; virtual void h() throw() = 0; virtual ~B(); }; class D : public B { public: virtual void f() throw(); virtual void g() throw(); /*final*/ void h() throw(); }; void D::f() throw() { g(); <-- 1 D::h(); <-- 2 D::g(); <-- 3 }
Although it seems as if D::f() should be able to use full qualification when calling D::g(), such a thing is dangerous and invokes the wrong function in some cases. For example, if the this object were actually of a further derived class that has an override of g(), the wrong function would be invoked: class D2 : public D { public: virtual void g() throw(); }; int main() { D2 x; x.f(); } Note that this is simply a specialization of the guideline presented in FAQ 33.12. |