typeid() broken for interfaces?

Paulo Pinto pjmlp at progtools.org
Mon Dec 3 02:20:53 PST 2012


On Monday, 3 December 2012 at 06:45:42 UTC, deadalnix wrote:
> On Monday, 3 December 2012 at 01:12:41 UTC, Walter Bright wrote:
>>
>>
>> On 12/3/2012 9:17 AM, deadalnix wrote:
>> > I'm still waiting to see an object that implement an
>> interface but that
>> > isn't a class instance.
>>
>> COM objects that come from code not written in D.
>
> OK that make sense. I have to think about it.

When coding against interfaces, it is always a good decision not 
to try to get back the object.

The main idea about using interfaces in first place is to have 
behavior independent of whatever class might implement it. If 
someone is trying to get back the implementation of a given 
interface, it is because the design is not sound in first place.

--
Paulo


More information about the Digitalmars-d mailing list