interface is interface

Pavel via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jun 17 12:02:33 PDT 2014


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

assert (a is b); // OK
assert (a is c); // FAIL WHY????
	
}


More information about the Digitalmars-d-learn mailing list