When a function is declared __________________, the function is expanded at the calling block.
-
friend
-
virtual
-
inline
-
static
When a function is declared inline, the compiler attempts to replace the function call with the function's actual code at the calling location. This eliminates function call overhead. friend is for access, virtual for polymorphism, static for class-level sharing.
Inline is correct. Declaring a function inline is a request to the compiler to substitute the function's body directly at each call site (expanding it in place) rather than generating a normal call/return sequence, trading code size for avoiding call overhead. friend only grants a function/class access to another class's private members — it says nothing about how the function is expanded. virtual does the opposite of inlining conceptually: it enables runtime polymorphic dispatch through a vtable, which typically prevents compile-time inlining. static (at namespace/file scope) just limits a function's linkage to the current translation unit; it doesn't affect call-site expansion.