I have a set of functions that work on a file. Originally I made it into a class, with the only private member being a static const std::string
which was the name of the file. The user used these functions by creating an object and calling functions from it. However, I think I'm going to switch to using a namespace, since it's just a set of functions and makes more sense. The only problem is that I still would like to keep that constant string. Would doing something along these lines be fine?
namespace FileHandler {
// Functions to do stuff with file
const std::string FILE_NAME;
}
I have a separate implementation file for the namespace, but I'm wondering if the loss of encapsulation from having the file name be a private member in a class is worth using the namespace instead.