Mail Archives: djgpp/2000/05/17/18:39:34
hello Djgpp I have a two more questions,
sometimes the file with int main gets too long to be practical and I would like to call non-class functions from main written on a new cpp page but I don't know how to connect it to main.how do you include non class cpp pages so main knows where to find the function ?
how do you overload the istream and ostream operators in a class template?
in the class declaration I have
template<class type,int numb>
class array{
friend ostream&operator<<<type,numb>(ostream&,const array&);
public:
...
private:
...;};
and in the cppfile I have
template<class type,int numb>
ostream &operator<<(ostream &output,const array<type,numb>& right){
int i;
for( i=0;i<right.size;i++){
output<<setw(6)<<right.ptr[i];
return output;}
but it doesn't work yet.
_______________________________________________________________________
Why pay when you don't have to? Get AltaVista Free Internet Access now!
http://jump.altavista.com/freeaccess4.go
_______________________________________________________________________
- Raw text -