On Tue, Nov 11, 2014 at 7:25 PM, Sven Barth <pascaldra...@googlemail.com>
wrote:

> On 11.11.2014 22:48, silvioprog wrote:
>
>> Oh, sorry. Just:
>>
>> unit Core.Singleton;
>>
>> {$mode objfpc}{$H+}
>>
>> interface
>>
>> type
>>
>>    { TSingleton }
>>
>>    generic TSingleton<T: class> = class(TObject)
>>    public
>>      class function GetInstance: T;
>>    end;
>>
>> implementation
>>
>> { TSingleton }
>>
>> class function TSingleton.GetInstance: T;
>> begin
>> end;
>>
>> end.
>>
>> And compiled like a charm. =)
>>
>
> Yes, since the ObjFPC dialect was developed without type overloading in
> mind (in Delphi (and FPC's mode Delphi) you can have TSingleton<T> and
> TSingleton<T, S> in the same unit) it was decided that it is not necessary
> to add the <T> at the definiton of the method as well.


Awesome. =)

-- 
Silvio Clécio
My public projects - github.com/silvioprog
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to