Why is casting Derived** to Base*const* forbidden ?

Posted by smerlin on Stack Overflow See other posts from Stack Overflow or by smerlin
Published on 2010-03-22T00:02:13Z Indexed on 2010/03/22 0:21 UTC
Read the original article Hit count: 631

Filed under:
|
|
|

After reading this question, i saw the answer by Naveen containing a link to this page, which basically says, that casting from Derived** to Base** is forbidden since could change a pointer to an pointer to a Derived1 object point to a pointer to a Derived2 object (like: *derived1PtrPtr=derived2Ptr).

OK, i understand this is evil ...

But when casting Derived** to Base*const* this is not even possible, so whats the reason that this is not allowed anyway ?

© Stack Overflow or respective owner

Related posts about c++

Related posts about casting