Learn C++ Online

Function templates (part 1)

On this page
This lesson contains approximately 17 minutes of video content.

Motivation and introduction

Defining and using function templates

Questions

Q1

QFunction templates, Q1

This question is ungraded.

To define a function template, we use the keyword  , followed by the type parameters that we’d like to announce inside angled brackets. Carefully fill in the blank with the correct keyword.

Q2

QFunction templates, Q2

This question is ungraded.

To introduce a type parameter, we use the keyword  . Carefully fill in the blank with the correct keyword.

Q3

QFunction templates, Q3

This question is ungraded.

Given the following code block,

template <typename T>
T MinimumValue(T a, T b) {
  return (b > a) ? a : b;
}
which of the following statements is true about template parameter T?