Re: code workaround for friend ostream& operator<< (ostream&, Array<T>&); *****SOLVED*******

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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















[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux