Quote:Original post by Hodgman
I'm guessing that you're trying to have one constructor call another one?
What's happening is that your code is (almost) creating a temporary Wrapper object inside the constructor.*** Source Snippet Removed ***In C++, if you want two (or more) constructors to share some code, you've got to do it yourself. e.g.*** Source Snippet Removed ***Or in this case you can merge them into one constructor using default arguments:*** Source Snippet Removed ***
on your last source bit, can you not use Wrapper(Cfg *cfg = new Cfg());?
I'm not sure about the limitations of default arguments as I've only ever used them for primitive data types.