Box2D 2.1.2 Joint Issue [solved]

I am new to Box2D, and I am trying to create some joints. I attempted to implement the following code which I found in the manual:

Code:
b2RevoluteJointDef jointDef;
jointDef.body1 = myBody1;
jointDef.body2 = myBody2;
jointDef.anchorPoint = myBody1->GetCenterPosition();
b2RevoluteJoint* joint = myWorld->CreateJoint(&jointDef);
//... do stuff ...
myWorld->DestroyJoint(joint);
joint = NULL;


However, when I cannot to assign the revolute joint (b2RevoluteJoint* joint) to the b2Joint that the myWorld->CreateJoint(&jointDef); call produces.
Can someone show me how to create this joint properly? Apparently, version 2.1.2 differs from the manual.

Thanks for any help you can offer.
CreateJoint returns a b2Joint*. Just store that generic pointer.
You can still cast if you really need access to the concrete class.
Thanks for the response. How would I cast it away? I thought in C++ you can only cast a derived class to a base class, not the other way around. But then again, I am new to the world of programming in general, so I may easily be mistaken.
cireNeikual wrote:
I thought in C++ you can only cast a derived class to a base class, not the other way around.


That's the "automatic" way.
The other way around is possible, but considered dangerous/dirty/slow (depending on the case).
Use static_cast if you're 100% sure of the actual type (or if you don't mind crashing in case of mistake).
Or use dynamic_cast and check, for safety.
But if you don't need to call methods specific to b2RevoluteJoint, there is no need to cast.
Thank you! I was able to use static_cast to make the conversion.

Original thread: https://box2d.org/forum/viewtopic.php?t=5832