If you do not qualify a function call with a class, all method calls will be treated equal, that is, dynamic sending, if virtual, static sending, if not virtual. When you fully qualify with the class name, the method you call effectively disables the dynamic dispatch mechanism and presents a direct method call.
class A{ virtual void Foo(){ Boo();
The implicit this pointer is not an important part of the discussion here, since it happens the same way when a call is made with an explicit object:
B b; b.Foo(); // will call B::Foo -- note 1 bA::Foo(); // will call A::Foo
Note 1: in this example, the compiler can exit the dynamic distribution mechanism because it knows the specific type of the instance (it sees the definition and is not a link / pointer), but you can imagine that the same thing would happen if b was a link or that the same thing if it were a pointer with -> instead .
source share