W3: CLASS TEMPLATES Flashcards

1
Q

W3-Q1: What is PARAMETRIC POLYMORPHISM?

A

The relationship that describes an IDENTICAL structure shared by CLASSES or FUNCTIONS

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

W3-Q2: How can we reduce CODE DUPLICATION?

A

By defining that structure in generic form: Class and function TEMPLATES

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

W3-Q3: What is a TEMPLATE DECLARATION?

A
is a definition if it defines a function, a class, or a static data member of a class template
_ The compiler uses the code immediately following the template header to define the function, class, or static data member. 
 _ The template's body does NOT extend beyond this definition.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

W3-Q4: A template parameter may be any combination of?

A

_ a type template parameter
_ a non-type template parameter
_ a template template parameter

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

W3-Q5: Describe about the TEMPLATE BODY?

A

_ A template BODY accepts externally specified types through the PARAMETERS in the template HEADER.
_ Parameters serve as PLACEHOLDERS throughout the template body for the ARGUMENTS specified in the template call.

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

W3-Q6: Does a TEMPLATE name have LINKAGE?

A

_ Yes
_ A non-member function template can have INTERNAL linkage.
_ Any other template name has EXTERNAL linkage.

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

W3-Q7: If the arguments in a function call are AMBIGUOUS in type, what does the compiler require?

A

an EXPLICIT specification of the type for which to generate the definition.

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