Multiple opCall's
useo
useo at start.bg
Mon Feb 21 02:18:11 PST 2011
Hey guys,
I've a small problem implementing multiple opCall()-methods. At first, I've the following interface:
interface Invoker {
void opCall(uint i);
}
... and an abstract class which inherits from the Invoker-interface like the following:
abstract class AbstractInvoker : Invoker {
private int myInt;
override void opCall(uint i) { /** do nothing */ }
void opCall() {
opCall(myInt);
}
}
I know... I can remove the opCall(uint i) from the interface, but it's needed for some other classes which implements this method. For
those classes the opCall(uint i)-method is needed.
But... when I now declare a class like this:
class InvokableClass : AbstractInvoker {
override void opCall(uint i) {
// do something
}
}
and do the following:
void main(string[] args) {
InvokableClass() ic = new InvokeableClass();
ic();
}
I always get the following errors:
Error: function InvokableClass.opCall (uint i) is not callable using argument types ().
Error: expected 1 function arguments, not 0
But I think opCall() is implemented in the abstract class and should be callable using opCall() instead using opCall(uint i)?
More information about the Digitalmars-d-learn
mailing list