🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.objects
Article #31

Re: Problem: function template in a class

#31
From: mme... Marek Meres
Date: Fri, 22 Dec 1995 00:00
49 lines
1403 bytes
	Przeczytalem list Krzysztofa Halasy i nie wiem czy dobrze rozumiem
problem. Jestem swiezy w OOP, liscie i w ogole Internecie, wiec za
ewentualna ignorancje z gory przepraszam:
> 
> Czesc,
> 
> Jak cos takiego zrobic:
> 
> class First
> {
>   template <class ArgType> void Func(ArgType Arg);
> };
> 
> Oczywiscie tak to nie przechodzi - nie rozumie ze w klasie moze byc template.

	A moze ?

> 
> Greetings,
>                                                 KHC
> 

Chyba mozna ten problem (no wlasnie, jaki problem) rozwiazac standardowo:

#include <iostream.h>

template <class T>
class Test
{
  public:
  T pisz(T t) { cout<<t ; return t ; }
} ;

class T_int : public Test<int>
{} ;

void main()
{
  T_int t1 ;
  t1.pisz(1) ;
}

(sprawdzalem na BC 3.1)

	Jakbys mogl Krzysiek, napisac dokladnie o co ci chodzi - chetnie bym
poszerzyl swoje horyzonty.
			Marek Meres

P.S. A tak poza tym, to Wesolych Swiat wszystkim !
Technical Details
Message-ID: <199512220903.KAA18667@amargosa.ict.pwr.wroc.pl>
Path: mbox-mo1.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
From: mme...@zeus.polsl.gliwice.pl (Marek Meres)
Subject: Re: Problem: function template in a class
Date: 1995/12/22
Message-ID: <199512220903.KAA18667@amargosa.ict.pwr.wroc.pl>
X-Deja-AN: 122615634
sender: obj...@sprocket.ict.pwr.wroc.pl
organization: Lista dyskusyjna obj...@sprocket.ict.pwr.wroc.pl
newsgroups: pl.comp.objects
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit