You wish to convert a container class to a template containe

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.

Solution

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.

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 t

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site