It is possible

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;
}
 
V

Victor Bazarov

Mike said:
Um... *what* is possible? Was this supposed to be a reply to some other
thread?

It seems to be a reply to the thread started by Gernot Frisch "explicit
specialization od c'tor". Hard to say which message it is a reply to...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,197
Messages
2,571,040
Members
47,642
Latest member
arunkumar99

Latest Threads

Top