Defining a custom *constructor* (not initializer!)

Jacob Carlborg doob at me.com
Mon May 7 12:57:05 PDT 2012


On 2012-05-07 18:01, Mehrdad wrote:
> On Monday, 7 May 2012 at 09:18:11 UTC, David Nadlinger wrote:
>>
>> Doing it without a separate factory function (and maybe disabling new
>> along with it by protecting the constructor) is not possible in D.
>
> Okay that answers my question then.

No, have a look at this example:

http://pastebin.com/UV5R82dg

A bit of a hack. An other option would to use a separate public method 
that acts as a constructor.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list