T
Tom McCallum
Hi,
Can someone please tell me the correct syntax (if its possible of course)
to specify an output stream operator for a templated class so that I dont
need to write the same function for all the derived classes from the
template. I have a sample of what it thought it might look like below.
==BEGIN CODE SNIPPET===
template<class T1, class T2>
class MyDerived : public MyClass {
friend ostream& operator<< (ostream& os, MyDerived<T1, T2> * sa);
....
};
template<class T1, class T2>
ostream& operator<< (ostream& os, MyDerived<T1, T2> * sa) {
}
===END CODE SNIPPED====
Thanks in advance for any suggestions.
Cheers
Tom
Can someone please tell me the correct syntax (if its possible of course)
to specify an output stream operator for a templated class so that I dont
need to write the same function for all the derived classes from the
template. I have a sample of what it thought it might look like below.
==BEGIN CODE SNIPPET===
template<class T1, class T2>
class MyDerived : public MyClass {
friend ostream& operator<< (ostream& os, MyDerived<T1, T2> * sa);
....
};
template<class T1, class T2>
ostream& operator<< (ostream& os, MyDerived<T1, T2> * sa) {
}
===END CODE SNIPPED====
Thanks in advance for any suggestions.
Cheers
Tom