How can you force instantiation of a template?

A

Showing Answers 1 - 1 of 1 Answers

bhimarao

  • Nov 8th, 2005
 

you can instantiat a template in two ways. 1. Implicit instantiation and 2. Explicit Instantion. implicit instatanitioan can be done by the following ways:

template <class T>

class A

{

public:

A(){}

~A(){}

void x();

void z();

};

void main()

{

A<int> ai;

A<float> af;

}

External Instantion can be done the following way:

int main()

{

template class A<int>;

template class A<float>;

}

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions