Falta usar un archivo de configuración
Closed this issue · 0 comments
mateocapon commented
solo en este caso pueden usar un singleton. Algo asi:
#include <iostream>
class Singleton {
Singleton(): atributo_const_pub(5) {
std::cout << "Se llama al constructor" << std::endl;
}
public:
const int atributo_const_pub;
static Singleton& getInstance() {
static Singleton instance; // se llama solo en la primera llamada a getInstance. Por que?
return instance;
}
private:
Singleton(const Singleton&) = delete;
Singleton& operator=(const Singleton&) = delete;
};
int main() {
std::cout << "Arranca el programa" << std::endl;
Singleton& instance = Singleton::getInstance(); // aca se llama al constructor de Singleton
Singleton& other = Singleton::getInstance(); // aca no se llama al constructor
return 0;
}
TPWorms/server_src/game_src/game_constants.h
Lines 4 to 9 in d5432b1