typeid() broken for interfaces?

deadalnix deadalnix at gmail.com
Tue Dec 4 00:50:36 PST 2012


On Tuesday, 4 December 2012 at 08:22:36 UTC, Maxim Fomin wrote:
> On Monday, 3 December 2012 at 15:52:24 UTC, Jacob Carlborg 
> wrote:
>> On 2012-12-03 16:51, Jacob Carlborg wrote:
>>
>>> Because Object is the root of the class hierarchy. That's how 
>>> it works
>>> in Java, for example. It's just because of these COM 
>>> interfaces, that
>>> are not D interfaces, that we have this behavior.
>>
>> Note, I'm not saying that an interface should be implicitly 
>> converted to any class, only to Object.
>
> And what happens if nobody implements an interface?
>

The same as abstract classes : you can get the typeid by looking 
at it throw child's typeid or typeid(type).

typeid(expression) will never return them because they can't be 
instantiated.


More information about the Digitalmars-d mailing list