On Sun, 01 May 2016 18:27:51 +0000 Lass Safin via Digitalmars-d-learn <digitalmars-d-learn@puremagic.com> wrote:
> On Sunday, 1 May 2016 at 11:17:27 UTC, earthfront wrote: > > Hello! > > [...] > > class A > > { int b; private this(int a){b=a;} } > > [...] > > I don't think classes are supposed to be able to have a private > constructor... There's no reason why you shouldn't be able to. Other, public constructors could call it, and other code within the module could call it. You can even have entire classes which are private. So, private constructors need to be possible. Now, whether that will ever work with something like emplace or the allocators, I don't know, since they're going to have access to the constructor to do their thing, but they're in different modules, which wouldn't normally have access to any constructors which aren't private (including protected and package, not just private). - Jonathan M Davis