Defining a custom *constructor* (not initializer!)

Mehrdad wfunction at hotmail.com
Mon May 7 09:01:48 PDT 2012


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.

> However, I don't quite see what it would gain you in the first 
> place – besides potentially screwing up the semantics users 
> expect from new…

It's a similar thing as when you override new's memory allocation 
part... yes, it can screw up the semantics, but it's assumed you 
know what you're doing...


More information about the Digitalmars-d mailing list