Article ID: 138446
Article Last Modified on 7/5/2005
/* Compile options needed: Default
*/
# include <iostream.h>
template<class T>
struct TempStruct
{
void bar() { cout << "Template generated" << endl; }
// Change the previous line into a comment and execute the following
// line to work around the problem:
// void bar();
};
// Execute the following lines to work around the problem:
// template <class T>
// inline void TempStruct<T>::bar()
// {
// cout << "Template generated" << endl;
// }
void TempStruct<float>::bar()
{
cout << "Template specialized" << endl;
}
void main()
{
TempStruct<int> F1;
TempStruct<float> F2;
F1.bar();
F2.bar();
}
// The output from the program is:
Template generated
Template generated
// The output should be:
Template generated
Template specialized
Additional query words: 9.0 9.00 10.0 10.00 10.10 10.20
Keywords: kbbug kbfix KB138446