signature output operator overload
Posted
by coubeatczech
on Stack Overflow
See other posts from Stack Overflow
or by coubeatczech
Published on 2010-05-02T13:25:07Z
Indexed on
2010/05/02
13:37 UTC
Read the original article
Hit count: 189
hi, do you know, how to write signature of a function or method for operator<< for template class in C++? I want something like:
template <class A> class MyClass{
public:
friend ostream & operator<<(ostream & os, MyClass<A> mc);
}
ostream & operator<<(ostream & os, MyClass<A> mc){
// some code
return os;
}
But this just won't compile. Do anyone know, how to write it correctly?
© Stack Overflow or respective owner