🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.delphi
Article #346929

Re: Funkcja z parametrem typu TObjectList<T>.

#346929
From: Roman Tyczka
Date: Thu, 14 Feb 2019 13:57
24 lines
1552 bytes
On Thu, 14 Feb 2019 13:01:07 +0100, Marcin G. wrote:

> Użytkownik "Roman Tyczka"  napisał w wiadomości grup 
> dyskusyjnych:4bs1g7phb19i$.dlg@tyczka.com...
> 
>> Po co do tego generyki? Nie możesz po prostu użyć samego TObjectList?
>>
>> function AddObjectList(AGenericObjectList: TObjectList): Boolean;
>>
> 
> Mam już trochę tych list generycznych i nie chcę tego przerabiać.
> Funkcja, a w zasadzie metoda ma być uniwersalna.

To możesz to zrobić jakoś tak:

function Add<T: class>(const aList : TObjectList<T>): Integer;

i potem gdzieś w kodzie:

lista.Add<TMojObiekt>(ListaObiektowMojObiekt);

-- 
pozdrawiam
Roman Tyczka
Technical Details
Message-ID: <1pfolk44eoitc$.dlg@tyczka.com>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!newsfeed2.atman.pl!newsfeed.atman.pl!.POSTED!not-for-mail
References: <5c654cbb$0$492$65785112@news.neostrada.pl> <4bs1g7phb19i$.dlg@tyczka.com> <5c65588b$0$488$65785112@news.neostrada.pl>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!newsfeed2.atman.pl!newsfeed.atman.pl!.POSTED!not-for-mail
From: Roman Tyczka <noemail@because.no>
Newsgroups: pl.comp.lang.delphi
Subject: Re: Funkcja z parametrem typu TObjectList<T>.
Date: Thu, 14 Feb 2019 14:57:57 +0100
Organization: ATMAN - ATM S.A.
Lines: 24
Sender: romek@tyczka.no.found
Message-ID: <1pfolk44eoitc$.dlg@tyczka.com>
References: <5c654cbb$0$492$65785112@news.neostrada.pl> <4bs1g7phb19i$.dlg@tyczka.com> <5c65588b$0$488$65785112@news.neostrada.pl>
NNTP-Posting-Host: ip-94-75-90-137.wave.com.pl
Mime-Version: 1.0
X-Trace: node1.news.atman.pl 1550152678 32454 94.75.90.137 (14 Feb 2019 13:57:58 GMT)
X-Complaints-To: usenet@atman.pl
NNTP-Posting-Date: Thu, 14 Feb 2019 13:57:58 +0000 (UTC)
User-Agent: 40tude_Dialog/2.0.15.84
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit