www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/05/17/18:39:34

Date: 17 May 2000 13:47:39 -0700
Message-ID: <20000517204739.28543.cpmta@c012.sfo.cp.net>
X-Sent: 17 May 2000 20:47:39 GMT
Mime-Version: 1.0
To: djgpp AT delorie DOT com
From: frans nagel <fransrn AT altavista DOT com>
X-Mailer: Web Mail 3.6.3.1
Reply-To: djgpp AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019