Are inline virtual functions really a non-sense?

Virtual functions can be inlined sometimes. An excerpt from the excellent C++ faq:

“The only time an inline virtual call
can be inlined is when the compiler
knows the “exact class” of the object
which is the target of the virtual
function call. This can happen only
when the compiler has an actual object
rather than a pointer or reference to
an object. I.e., either with a local
object, a global/static object, or a
fully contained object inside a
composite.”

Leave a Comment