How would I achieve this dynamic_cast?
Code:
(I am not the one who defined these classes)
class _jobject {};
class _jarray : public _jobject {};
typedef _jobject* jobject;
typedef _jarray* jarray;
int main()
{
jobject * a;
jarray b;
a = dynamic_cast<jobject*> (&b);
....
}
This doesn't work and the problem is the only type names I'm guaranteed to have are jobject and jarray. The original _jobject is how it's defined here but I'm not guaranteed it''ll always be that way so I have to work with jobject/jarray.
This works at runtime:
Code:
jobject a;
jarray b;
a = ( jobject ) b;
So why doesn't the dynamic cast?
How would I cast between jobject and jarray (and other types if coming in, I only know it's of type <some_sub-Type>?