During Compilation, The function call is replaced by function code for which function?
-
Virtual functions
-
Inline functions
-
Static functions
-
Friend functions
Inline functions are expanded at compile time - the compiler replaces the function call with the actual function code, eliminating the overhead of function call mechanism. Virtual functions use dynamic binding, static functions have class scope, and friend functions are non-member functions with special access rights.
Inline functions are expanded by the compiler at each call site: the function call is literally replaced with the function's own code, avoiding the overhead of a normal function call at the cost of a larger compiled binary. Virtual functions, by contrast, are resolved at runtime via a vtable and specifically cannot be inlined when called polymorphically, since the actual implementation isn't known until execution.