code workaround for friend ostream& operator<< (ostream&, Array<T>&); *****SOLVED*******
Morten.Gulbrandsen
f1000mhz@yahoo.de
Sun Feb 6 19:00:00 GMT 2005
hello, the problem is solved!
solution:
template <class T> // declare the template and the parameter
class Array // the class being parameterized
{
public:
// constructors
Array(int itsSize = DefaultSize);
Array(const Array &rhs);
~Array() { delete [] pType; }
// operators
Array& operator=(const Array&);
T& operator[](int offSet) { return pType[offSet]; }
const T& operator[](int offSet) const
{ return pType[offSet]; }
// accessors
int GetSize() const { return itsSize; }
/**************************<>*****************************/
friend ostream& operator<< <> (ostream&, Array<T>&);
/**************************<>*****************************/
private:
T *pType;
int itsSize;
};
I got the important help from here
alt.comp.lang.learn.c-c++
On Sat, 05 Feb 2005 17:37:55 +0100, Morten Gulbrandsen wrote:
>>
>> friend ostream& operator<< (ostream&, Array<T>&);
>> //======================================================//
>
>
>
The syntax is very confusing. Try:
friend ostream& operator<< <> (ostream&, Array<T>&);
Alwyn
More information about the Gcc-help
mailing list