interface I { }
class A : I { }
class B : A { }
unittest
{
A a = new A();
B b = new B();
writeln(typeid(a)); //Prints A
writeln(typeid(b)); //Prints B
a = b;
writeln(typeid(b)); //Prints B
I i = b;
writeln(typeid(i)); //Prints I ????????
}
When using the typeid expression on a instance of an interface it
gives the type of the interface not the type of the underlying
object. Is this intended or is it a bug?
- TypeInfo of interfaces bugg or feature? TheFlyingFiddle
- Re: TypeInfo of interfaces bugg or feature? Adam D. Ruppe
