Ok, similar to the link you posted, what you want to do seems to be in the documentation already
Since you have your field named CLASS:
<field mandatory="true" name="CLASS">
You then use that field as the target of a file:
<files>
<file source="default.cpp" target="%CLASS:l%..%CppSourceSuffix%" openeditor="true" />
<file source="default.h" target="%CLASS:l%.%CppHeaderSuffix%" openeditor="true" />
</files>
Maybe you can try to modify an existing template first instead of creating from scratch?