Hello,
I have few questions regarding dynamic casting , typeid() and templates
1) How come typeid does not require RTTI ?
2) dynamic_cast on polymorphic type:
When I do downcast (Base to Derive) with RTTI - compilation passes
When RTTI is off - I get a warning (warning C4541: 'dynamic_cast' used on polymorphic type 'CBase' with /GR-; unpredictable behavior may result)
- When I do upcast (Derive to Base), with or without RTTI - compilation passes smoothly
What I don't understand is why when I do upcast and RTTI is off - I don't get any warning/error!
3) dynamic_cast on NON polymorphic type:
- When I do downcast with or without RTTI - compilation fails (error C2683: 'dynamic_cast' : 'CBase' is not a polymorphic type)
BUT
- When I do upcast with or without RTTI - compilation passes smoothly.
How come on upcast on NON polymorphic type passes w/o RTTI ?
4) Does 'inline' in front of a template function has any effect, i.e. when the compiler compiles the function and see it is 'inline' it will actually treat the function as inline or it is ignored?
Thank you very much for the assistance David