When will this downcast fail? I just got a bad pointer out of this cast...(0xbaadf00dbaadf00d )Code:struct A
{
};
struct B : public A
{
};
A* a = new A();
B* b = (B*) a;
Thanks
Jack
Printable View
When will this downcast fail? I just got a bad pointer out of this cast...(0xbaadf00dbaadf00d )Code:struct A
{
};
struct B : public A
{
};
A* a = new A();
B* b = (B*) a;
Thanks
Jack
The created *a has no place for double b; that is appeared to belong in struct B.Code:struct A
{
int a;
};
struct B : public A
{
double b;
};
A* a = new A();
Why this thing is always a problem? I mean I create FRAME's inside this function (the B) and return to the caller, then the caller accepts it as a derived class (the A)
Even on an explict castCode:newFrame->pFrameSibling
= (FRAME*)CopyFrameHierarchy((const FRAME*)other->pFrameSibling);