----------遍历函数-----------------------------------------
template<typename T>
void MyStack<T>::stackTraverse(bool Transform)
{
if(Transform)
{
for(int i = 0; i < m_iTop; i++)
{
cout<<m_pBuffer[i];
//m_pBuffer[i].printCoordinate();
}
}
else
{
for(int i = m_iTop-1; i >= 0; i--)
{
cout<<m_pBuffer[i];
//m_pBuffer[i].printCoordinate();
}
}
cout<<endl;
}
------------重载-------------------------
ostream& operator<<(ostream &out, Coordinate &coor)
{
out<<"<"<<coor.m_iX<<","<<coor.m_iY<<">"<<endl;
return out;
}
可能是没有#include<ostream>和using namespace std
头文件的问题吧,或者就是 你重载函数的时候出现了问题。