get actual classinfo through an interface?

Robert Fraser fraserofthenight at gmail.com
Thu Nov 22 12:02:04 PST 2007


Christopher Wright wrote:
> Robert Fraser wrote:
>> BC wrote:
>>> new question. since IInterface.classinfo returns IInterface, how to get
>>> the actual value of the concrete class?
>>>
>>
>> typeid.
>>
>> interface Foo { }
>> class Bar : Foo { }
>> // ...
>> Foo foo = new Bar();
>> TypeInfo ti = typeid(foo);
> 
> Error: foo is used as a type.

Oops, shouldn't shoot my mouth off unless I actually know what I'm 
talking about.

Attempt 2: A series of casts and .classinfo should work.


More information about the Digitalmars-d-learn mailing list