I got confused in overloading the ostream operator<< for my template class. (unnecessary code deleted)
sparseArray2D.h:
#include <iostream>
using namespace std;
template <typename T>
class sparseArray2D
{
private:
//...
public:
//...
friend ostream& operator << (ostream&, const sparseArray2D<T>&);
//...
}
template <typename T>
ostream& operator << (ostream& os, const sparseArray2D<T> &_matrix)
{
//...
os<<"Overloaded operator works";
return os;
};
and main:
#include "sparseArray2D.h"
int _tmain(int argc, _TCHAR* argv[])
{
//...
sparseArray2D<int> *matrX = new sparseArray2D<int>(10, 9, 5);
cout << matrX;
//...
}
No errors and no warnings in VS2012, but in the console I have 8 symbols as link or pointer at object. Like "0044FA80".
What's going wrong?