Click here to Skip to main content
15,899,313 members

Comments by Joerg Michels (Top 2 by date)

Joerg Michels 30-Jan-22 8:57am View    
Hi Greg,

thanks for your advice. I think I need to look deeper into the standard as you suggested.

As far as I understand it, the problem is related to the cast via the void pointer. A direct upcast from type X* to B* and then a downcast back to type X* works without problems.

I'll have to take a closer look at that...
Joerg Michels 29-Jan-22 6:44am View    
Thanks, but you left out an important point. During the program run the variable pX becomes a void pointer. Later on I want to cast it back to the original type.

That code is just to show the problem. In instruction flow I 'know', that the void pointer always is of type B* or any inherited type. So I want to check if it is from type X*, so I tried a dynamic_cast to X*.