<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Nov 11, 2014 at 7:25 PM, Sven Barth <span dir="ltr"><<a href="mailto:pascaldragon@googlemail.com" target="_blank">pascaldragon@googlemail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>On 11.11.2014 22:48, silvioprog wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Oh, sorry. Just:<br>
<br>
unit Core.Singleton;<br>
<br>
{$mode objfpc}{$H+}<br>
<br>
interface<br>
<br>
type<br>
<br>
{ TSingleton }<br>
<br>
generic TSingleton<T: class> = class(TObject)<br>
public<br>
class function GetInstance: T;<br>
end;<br>
<br>
implementation<br>
<br>
{ TSingleton }<br>
<br>
class function TSingleton.GetInstance: T;<br>
begin<br>
end;<br>
<br>
end.<br>
<br>
And compiled like a charm. =)<br>
</blockquote>
<br></span>
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.</blockquote></div><div><br></div><div>Awesome. =)</div><div><br></div>-- <br><div>Silvio Clécio<br>My public projects - <a href="http://github.com/silvioprog" target="_blank">github.com/silvioprog</a></div>
</div></div>