Are “inline virtual” member functions ever actually “inlined”?
Occasionally… When the object is referenced via a pointer or a reference, a call to a virtual function cannot be inlined, since the call must be resolved dynamically. Reason: the compiler can’t know which actual code to call until run-time (i.e., dynamically), since the code may be from a derived class that was created after the caller was compiled. Therefore 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. Note that the difference between inlining and non-inlining is normally much more significant than the difference between a regular function call and a virtual function call. For example, the difference between a regular function call and a virtual function cal
Related Questions
- What is the scope of practice for the graduate nurse? Can a graduate nurse perform the same functions of a licensed nurse before he/she is actually licensed?
- How does the analyst collect the information needed to determine the Job requirements and what functions are actually being performed?
- Are "inline virtual" member functions ever actually "inlined"?