16 - Templates Flashcards

1
Q

What is a template?

A

A template allows you to define functions and classes that have parameters for type names. This enables you to design functions that can be used with arguments of different types and to define classes that are very general.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the template prefix and how is its syntax?

A

The template prefix tells the compiler that the function declaration that follows is a template.

template

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How do you call a function template?

A

You need not do anything special when you call a function that is defined with a function template.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the syntax for class templates?

A

The syntax details for class templates are basically the same as those for function templates:

template

How well did you know this?
1
Not at all
2
3
4
5
Perfectly