Computer Science - Object Oriented Programming Using C++ - Discussion


The type to be used in an instantiation of a class template follows ________

[A]. the generic class name
[B]. the keyword template
[C]. the keyword class
[D]. the template definition

Answer: Option A


No answer description available for this question.

Evangelin said: (Nov 5, 2011)  
What is generic class?

Aady said: (Nov 13, 2011)  
Templates are a way of making your classes more abstract by letting you define the behavior of the class without actually knowing what datatype will be handled by the operations of the class. In essence, this is what is known as generic programming; this term is a useful way to think about templates because it helps remind the programmer that a templated class does not depend on the datatype (or types) it deals with.

Ayesha. said: (Jun 14, 2020)  
Class template instantiation.

A class template by itself is not a type, or an object, or any other entity. No code is generated from a source file that contains only template definitions. In order for any code to appear, a template must be instantiated: the template arguments must be provided so that the compiler can generate an actual class (or function, from a function template).

Explicit instantiation
template class name < argument-list > ; (1)

Post your comments here:

Name *:

Email   : (optional)

» Your comments will be displayed only after manual approval.