opCall override default constructor?
Jacob Carlborg via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Jun 2 01:50:26 PDT 2016
Is it intentional that a non-static opCall overrides the default
constructor of a struct?
struct Foo
{
int a;
void opCall(string b) { }
}
void main()
{
auto f = Foo(3); // line 14
f("asd");
}
The above code gives the following error:
main.d(14): Error: function main.Foo.opCall (string b) is not callable
using argument types (int)
--
/Jacob Carlborg
More information about the Digitalmars-d-learn
mailing list