Look at this code:
#include <framework_i_hate.h>
int main() {
XFile file("./my_file.xxxx", "create");
XObject object("my_object");
// modify the object
object.Write();
}
Try to guess where object
will be saved... yes, you guessed it. I think this is too magic, I'd like to write something like object.Save(file)
, but it's not necessary. Obviously there is global variable inside framework_i_hate.h
that it is modified during the file
constructor. What do you think about this side effect inside constructor?
How can this behavior be hidden?
A bonus to who guess the framework.