Paul Pluzhnikov wrote:

> Andreas Schallenberg <[EMAIL PROTECTED]> writes:
> 
>> X * ptr;
>> cout << "type is " << typeid(*ptr).name() << endl;
> 
> Just a word of caution: if X doesn't have virtual functions,
> typeid(*ptr) will "answer" X even if "ptr" points to a subclass of X.
> ...

Good point!

It is wise to have at least the destuctor virtual
for the candidate classes. This is sufficient to make
the RTTI work, AFAIK.

RU,
Andreas

_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to