Subtyping Body

How can I create a subtype of body? I want to extend body so that I can have my own methods. When I try to extend it it requires me to have this constructor:

protected BumperSubBody(World world, long addr) {
super(world, addr);
}

What is addr?

Where could I place my code for like bodyDef and fixtureDef?
What kinds of methods are you trying to add? The typical approach, and pretty flexible one, is to just hook into b2Body through the userData. You can create your own game object class hierarchy and also route the contact listener calls to those same classes.

What's nice about this, it keeps Box2D very separate. Additionally, at least in the C++ version, the methods are non-virtual and inlined. This tends to increase performance and hurt extensibility, which is fine, since you can think of Box2D as this thing your actual real game objects have to use to interact physically.

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