interface is interface
Steven Schveighoffer via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Jun 17 12:39:01 PDT 2014
On Tue, 17 Jun 2014 15:02:33 -0400, Pavel <phondogo at gmail.com> wrote:
> Hello!
>
> import std.stdio;
>
> interface I {
>
> }
>
> interface B : I {
> void test();
> }
>
> interface C : I {
> void test1();
> }
>
> class A : B, C {
> override void test() {}
> override void test1() {}
> }
>
> void main() {
> A a = new A();
> I b = cast(B)a;
> I c = cast(C)a;
>
> writeln(cast(void*)a, " ", cast(void*)b, " ", cast(void*)c); //
> 1EE1FE0 1EE1FE8 1EE1FEC
b and c should be identical IMO. This means there are 2 entries for I
inside the object, which is a waste of space.
>
> assert (a is b); // OK
This should also fail. It seems like a bug to me. 'is' should compare
pointers, not anything else.
-Steve
More information about the Digitalmars-d-learn
mailing list