I'm both HDL designer an C++ programmer. When we talk about a C++ programm, we do not "instantiate" a code like we can instantiate an floating-point-adder-code in VHDL, for example.
What you want may be a library:
You Write one C++ file where various functions a declared and save this file under "myLib.h". Now you can use this functions in another file by writting
Code:
#include "myLib.h"
in the top-part of your file (the part where you include other libs, like "stdio.h" or "iostream")