Actual code for a template function is generated when —

2022

Actual code for a template function is generated when —

  1. A.

    the function declaration appears in the source code

  2. B.

    the function definition appears in the source code

  3. C.

    a call to the function appears in the source code

  4. D.

    the function is executed at runtime

Attempted by 195 students.

Show answer & explanation

Correct answer: C

C++ templates are instantiated only when the function is called , not when declared or defined.

Explore the full course: Uppsc Polytechnic Lecturer 2025 Cs