vendredi 3 mars 2017

How can a pure-virtual function be invoked without its name being explicitly qualified?

You'll find the following text in [basic.def.odr]/2 in C++11:

A virtual member function is odr-used if it is not pure. A non-overloaded function whose name appears as a potentially-evaluated expression or a member of a set of candidate functions, if selected by overload resolution when referred to from a potentially-evaluated expression, is odr-used, unless it is a pure virtual function and its name is not explicitly qualified.

According to highlighted text above, it's possible to invoke a pure virtual function as a potentially-evaluated expression, without its name being explicitly qualified. This answer by Michael Burr seems to show the only way, one can call a pure virtual function, and it has to use a qualified name.

PS: For those wondering why am I still referring the question to the C++11 Standard, please see my prior question here.

Aucun commentaire:

Enregistrer un commentaire