typeid() broken for interfaces?

Gor Gyolchanyan gor.f.gyolchanyan at gmail.com
Sun Dec 2 21:43:40 PST 2012


Wouldn't it be better to return the class's typeinfo if it is a class and
the interface's typeinfo if it isn't? The interface would then return the
most derived typeinfo that it knows of. I think, just because the interface
can be something other then a class object, doesn't mean it should be
treated as though it will never be a class object.


On Mon, Dec 3, 2012 at 5:10 AM, Walter Bright <newshound2 at digitalmars.com>wrote:

> On 12/3/2012 6:26 AM, Gor Gyolchanyan wrote:
>
>> What's the logic in this behavior?
>>
>
> Think of it this way. An int can be implicitly converted to a long, but
> they have different typeid's because they are different bits.
>
>


-- 
Bye,
Gor Gyolchanyan.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20121203/509f8458/attachment.html>


More information about the Digitalmars-d mailing list