You wish to convert a container class to a template container class. Which of th
ID: 3922050 • Letter: Y
Question
You wish to convert a container class to a template container class. Which of the following should you consider?
a. Make implementation visible. One way to do this is to include both interface and implementation in the header file.
b. Make sure operations on container data are not type specific. For example, don't use string functions on container data.
c. Make sure all return statements that return container data only return container data. If a return statement returns container data under certain conditions, but another return statement returns something that is not container data under other conditions, there could be a data type conflict when a different data type is used for this template.
d. Make the class visible to the client. One way to do this is to include the main function in the header file.
a. Make implementation visible. One way to do this is to include both interface and implementation in the header file.
b. Make sure operations on container data are not type specific. For example, don't use string functions on container data.
c. Make sure all return statements that return container data only return container data. If a return statement returns container data under certain conditions, but another return statement returns something that is not container data under other conditions, there could be a data type conflict when a different data type is used for this template.
d. Make the class visible to the client. One way to do this is to include the main function in the header file.
Explanation / Answer
To convert a container class to a template container class we need to
So the answer is option a and b. i.e
a. Make implementation visible. One way to do this is to include both interface and implementation in the header file.
b. Make sure operations on container data are not type specific. For example, don't use string functions on container data.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.