reimplementing an interface in a derived class

bauss jj_1337 at live.dk
Fri Jan 4 07:37:43 UTC 2019


On Friday, 4 January 2019 at 00:19:05 UTC, Alex wrote:
> On Friday, 4 January 2019 at 00:15:28 UTC, Neia Neutuladh wrote:
>> On Thu, 03 Jan 2019 23:44:15 +0000, Alex wrote:
>>> I assume that is another bug and has nothing to do with 
>>> interfaces...
>>
>> B.foo is both overriding A.foo and implementing D.foo, so 
>> that's not a bug.
>
> I don't have any interfaces in my example.
> B.foo overrides A.foo. By casting a B object to be an A object, 
> A's behavior should be granted, shouldn't it?

No, because you OVERRIDE A's foo().

A does not exist. A is B and when you cast B to A you just tell 
the compiler that the reference should only have A's signature 
available.

You're not assigning B to A.


More information about the Digitalmars-d-learn mailing list