🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.objects
Article #32

Re: Problem: function template in a class

#32
From: k... Krzysztof Halasa
Date: Fri, 22 Dec 1995 00:00
51 lines
1702 bytes
Marek Meres (mme...@zeus.polsl.gliwice.pl) wrote:
KH> > class First
> > {
> >   template <class ArgType> void Func(ArgType Arg);
> > };

> 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) ;
> }

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

No tak, tak sie da to zrobic... Ale ja musze miec obiekty jednego typu,
czyli deklaracja musi byc np.:
{
First moja_klasa;	// a raczej moja_klasa[];

// A potem musze robic
First.Func(10)
First.Func("qwerty");
First.Func('x');
}

Oczywiscie sam moge wyprodukowac wszystkie funkcje (nie jako templates), ale
chcialbym by komplikator zrobil mi to automatycznie.

Greetings,
                                                KHC

--------------------------------------------------------------------
Krzysztof Halasa
Network Administrator of The Palace of Youth in Warsaw

Palac Mlodziezy                      Internet: k...@pm.waw.pl
ul. Swietokrzyska                     Fidonet: KHC, 2:480/40
00-901 Warsaw, Poland
Technical Details
Message-ID: <4bdupa$9dp@hq.pm.waw.pl>
Path: mbox-mo1.pugleaf.net!unknown!not-for-mail
References: <199512220903.KAA18667@amargosa.ict.pwr.wroc.pl>

Show Full Headers
Complete Article Headers
From: k...@hq.pm.waw.pl (Krzysztof Halasa)
Subject: Re: Problem: function template in a class
Date: 1995/12/22
Message-ID: <4bdupa$9dp@hq.pm.waw.pl>
X-Deja-AN: 122615635
references: <199512220903.KAA18667@amargosa.ict.pwr.wroc.pl>
organization: The Palace of Youth in Warsaw
newsgroups: pl.comp.objects
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit