delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/05/15/09:33:34

Date: Thu, 15 May 1997 09:32:25 -0400
From: Bryan Murphy <bryan AT hcst DOT com>
Subject: Re: djgpp & templates
To: daniel k rathjens <drathj01 AT xlab1 DOT fiu DOT edu>
cc: djgpp AT delorie DOT com
In-Reply-To: <5ldh84$dr6@isis.fiu.edu>
Message-ID: <Pine.3.89.9705150904.C8731-0100000@alpha.hcst.com>
MIME-Version: 1.0

> : This is my problem : this simple class doesn't compile ! 
> : WHY!??? ... :-<<<<
> : template <class T> myclass<T>::myclass(T tinf)
> : {
> : 	cout << "Hello World!" << endl;
> : 	inf = tinf;
> : }
> you need to specify a type that the function is going to return.
> template <class T>
> void myclass<T>::myclass(T tinf)
> ^^^^
>   like that

Wrong, by omitting the void, the function would default to returning an 
int.  Now, I don't remember what the rest of the template code looks 
like, but I'd bet it's an instantiation problem.  I'd go back and look 
except I already deleted the original message.

- Raw text -


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