code is not compiling
- by user323422
template< class Type ,int Size = 3>
class cStack
{
Type *m_array;
int m_Top;
int m_Size;
public:cStack();
friend std::ostream& operator <<(std::ostream &, const cStack<Type,Size> &);
};
template< class Type ,int Size >
std::ostream& operator << ( std::ostream &os, const cStack<Type,Size> &s)
{
for( int i=0; i<=s.GetTop();i++)
{
os << s.m_array[i];
}
return os;
}
on compilin it showing following error
error LNK2019: unresolved external symbol "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl operator<<(class std::basic_ostream<char,struct std::char_traits<char> > &,class cStack<int,3> const &)" (??6@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@AAV01@ABV?$cStack@H$02@@@Z) referenced in function _main