W3: CLASS TEMPLATES Flashcards
W3-Q1: What is PARAMETRIC POLYMORPHISM?
The relationship that describes an IDENTICAL structure shared by CLASSES or FUNCTIONS
W3-Q2: How can we reduce CODE DUPLICATION?
By defining that structure in generic form: Class and function TEMPLATES
W3-Q3: What is a TEMPLATE DECLARATION?
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.
W3-Q4: A template parameter may be any combination of?
_ a type template parameter
_ a non-type template parameter
_ a template template parameter
W3-Q5: Describe about the TEMPLATE BODY?
_ 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.
W3-Q6: Does a TEMPLATE name have LINKAGE?
_ Yes
_ A non-member function template can have INTERNAL linkage.
_ Any other template name has EXTERNAL linkage.
W3-Q7: If the arguments in a function call are AMBIGUOUS in type, what does the compiler require?
an EXPLICIT specification of the type for which to generate the definition.