[fix #22] Modify default C++ template to instantiate classes on heap

To prevent stackoverflow error when creating an object,
each problem instance should be created on heap rather on stack.
The default C++ test code template is modified to fix this.

Issue: #22