My question is regarding the GetCurrentDebugLevel function above. Ideally I would like to use just one function to get the current debug level of the class, the std::string form would be used to save the "debugging level" in a settings file and the enumerated version would for evaluation purposes throughout the program.
My question is if implementing function prototypes by return value the best way to go or should I do something else?
Again, I like the ability to just use one function for things like this.
I wouldn't do it this way. If the only difference is the return type then somewhere, somehow, the rules for function resolution will trip you up and you'll end up calling the wrong function. Consider void GetCurrentDebugLevel(std::string &) const instead. This way there will be no ambiguity.
Personally, I think accessor methods are overused. Is there a compelling reason to make CurrentDebugLevel private with accessors instead of just making it public? With accessors you can't take its address, or increment/decrement it, or get a reference to it, or ....
Thanks; I might try your void function or your second suggestion.
The reason why I always used accessor methods was the control it offered with the access.
In the example above let's consider the following scenario:
Suppose, in using the Debugger class above, once the debug level is set you don't want to change it for the life of the class instance. AKA once the debug level is set to high you don't want to accidentally change the debug level to something else.
With the Get/Set way of doing things this is achievable but I am assuming with the other way you would have to either make CurrentDebugLevel constant or do a check all of the time.