On 12/05/2017 11:23 PM, IM wrote:
Assume the following:
interface IFace {
void foo();
void bar();
}
abstract class A : IFace {
override void foo() {}
}
class B : A {
override void bar() {}
}
Now why this fails to compiler with the following message:
--->>>
function bar does not override any function, did you mean to override
'IFace.bar()'?
<<<---
Obviously, I meant that, since the abstract class A implements IFace,
and B derives from A.
Do I need to declare IFace's unimplemented methods in A as abstract? If
yes, why? Isn't that already obvious enough (any unimplemented virtual
function is abstract)?
Just remove the override keywords in this case. No function is
overriding any implementation here, they both implement an interface
function. The fact that override can be used for A.foo can be seen as an
inconsistency or a bug.
Ali