Move ctor and dtor into header.

The constructor and destructor are trivial enough that we just have them
inline.  The ctor is also marked as protected since implementations will
be via the wrapper.
Make a unique name for each generated subclass.
Move subclass generation into GenerateSubclass().