C++ use static obj to call functions auto before main
change the way to register a new class in factory