G
gMorphus
At least with my VC6 compiler.
Look at that code:
template<class T>
class Bla
{
public:
Bla(const T& obj) {
cout << "regular c'tor\n";
pr = obj;
}
void Echo() {
cout << "regular echo " << pr << "\n";
}
private:
T pr;
};
template <>
Bla<double>::Bla(const double& obj)
{
cout << "double c'tor\n";
pr = obj;
}
int main(void)
{
double d = 1;
Bla <char>b(d);
b.Echo();
Bla<double>bb(d);
bb.Echo();
return 0;
}
Look at that code:
template<class T>
class Bla
{
public:
Bla(const T& obj) {
cout << "regular c'tor\n";
pr = obj;
}
void Echo() {
cout << "regular echo " << pr << "\n";
}
private:
T pr;
};
template <>
Bla<double>::Bla(const double& obj)
{
cout << "double c'tor\n";
pr = obj;
}
int main(void)
{
double d = 1;
Bla <char>b(d);
b.Echo();
Bla<double>bb(d);
bb.Echo();
return 0;
}