overloading evaluation (treating objects as functions)
dan via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun May 17 11:49:39 PDT 2015
Is it possible to define a class F so that
auto f=new F();
writeln("The value of f at 7 is ",f(7));
compiles and works as expected?
So the idea would be to be able to use notation like
f(7)
instead of
f.eval(7)
or something along those lines.
My guess is no, it is impossible to do this, because i can't find
it on the internet or in Alexandrescu's book.
But it is also possible that everybody considers it so obvious
that they just don't elaborate on it. I'd be delighted if there
were the case, at least if somebody would elaborate on it if so.
TIA for any info!
dan
More information about the Digitalmars-d-learn
mailing list