Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2005-03-01 13:36:27


Chris Just <cpjust_at_[hidden]> writes:

> Jody Hagins wrote:
>>> I've been looking through the boost library and I haven't been able to
>>> find anything that works like typeid() that returns the exact (i.e.
>>> derived) class name instead of just the base class.
>>> I want to compare two derived classes to make sure that they are of
>>> the same class, but typeid() only returns the name of the base class.
>>>
>>> If there is a boost function that does this, or if someone has a way
>>> of doing it could you please point me in the right direction?
>>
>> Funny about timing...
>>
>> I think I can answer your question, but I must answer with another
>> question. What do you mean by "typeid() only returns the name of the
>> base class?" This is surely not the case for polymorphic types, at
                                                 ^^^^^^^^^^^
>> least according to the standard. Maybe if you post a bit of code, which
>> represents what you are trying to accomplish, I can help...
>
> I'm using MS Visual C++ 6.0. This is what I'm doing:
>
> CBase { ... };
> CDerived : public CBase { ... };

A polymorphic type has at least one virtual function.

HTH,

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk