On Thursday, 24 January 2019 at 12:58:15 UTC, JN wrote:
Doh. Of course. I feel so dumb. I just had it at @disable
this();, then replaced @disable with private without thinking
to add {}
Give me a nickel for every time I've made an edit like that...!
On Thursday, 24 January 2019 at 12:52:47 UTC, Arafel wrote:
You are declaring the constructor, but not defining it, i.e.
you're telling the compiler that it's in some other compilation
unit.
The compiler won't complain, but the linker will.
If you replace:
[...]
with:
[...]
it should
You are declaring the constructor, but not defining it, i.e. you're
telling the compiler that it's in some other compilation unit.
The compiler won't complain, but the linker will.
If you replace:
private this();
with:
private this() {}
it should work.
A.
On 1/24/19 1:48 PM, JN
On Wednesday, 23 January 2019 at 19:41:44 UTC, Alex wrote:
On Wednesday, 23 January 2019 at 19:26:37 UTC, JN wrote:
class Foo
{
static Foo makeFoo()
{
Foo f = new Foo();
return f;
}
}
void main() {
Foo f = Foo.makeFoo();
}
For a code like this. I'd like all
On Wednesday, 23 January 2019 at 19:26:37 UTC, JN wrote:
class Foo
{
static Foo makeFoo()
{
Foo f = new Foo();
return f;
}
}
void main() {
Foo f = Foo.makeFoo();
}
For a code like this. I'd like all users of the class to be
forced to create instances using the
class Foo
{
static Foo makeFoo()
{
Foo f = new Foo();
return f;
}
}
void main() {
Foo f = Foo.makeFoo();
}
For a code like this. I'd like all users of the class to be
forced to create instances using the static method makeFoo. I
want to disallow "new Foo()".