DataHandler::DataHandler(){
//just call the constructor with the default file.
DataHandler(DEFAULT_FILE);
}
This code doesn't do what you think it does. It doesn't delegate the constructor call (as it would in Java, IIRR). Instead, it creates a temporary DataHandler
initialised with DEFAULT_FILE
, which is immediately destroyed again. The "correct" debug output you see comes from this temporary.
To solve this, drop the default constructor and change the single-parameter one like this:
DataHandler::DataHandler(const char* filename = DEFAULT_FILE) {
RefreshFromFile(filename);
}