Answer the following statements true (T) or false (F)
1. Templates can make available to the programmer the generality of algorithms that implementation with specific types conceals.
2. With regard to programming usage, consistency in coding is more important than optimality.
3. To instantiate and call, a template function requires special syntax.
4. The template prefix can be written template
5. Templates provide an overloading of the function for every possible type that is consistent with the use in the template.
1. True
In many functions, the algorithm that is implemented is more general than the implementation. Templates provide, in effect, an overloading of the function for every possible type that is consistent with the use in the template. For example, if you assign template parameter objects, this must make sense for the type.
2. True.
If one is inconsistent with many details in coding, the reader will make more errors than would happen otherwise.
3. False.
If the function template is available in the file, it is only necessary to write the function name with arguments, that is, to act as if the needed function definition is already present. The compiler will figure out the types and generate the instance of the function template.
4. True
The C++ Standard provides for use of either class or typename in here, but the text, recognizing common usage, has standardized on the use of the keyword class. Nevertheless, you may see this in code you read, so you should be able to recognize it.
5. False
The compiler does not provide every possible overloading. Nevertheless, the compiler does behave as though overloadings for every possible type were present.
You might also like to view...
Where are class declarations usually stored?
a. on separate disk volumes b. in their own header files c. in .cpp files, along with function definitions d. under pseudonyms e. None of these
Scanning your computer for viruses is typically done by:
A) the registry B) malware C) virus checker software D) an executable file
Select the group whose mission is to create guidelines and standards for Web Accessibility
a. ICANN b. Web Accessibility Initiative (WAI) c. International Webmasters Association (IWA) d. Internet Society
After you start a program and create a new file, the file exists only in your computer's ____________________, which is a temporary storage location.
Fill in the blank(s) with the appropriate word(s).