I have a base class which when I call constructor which accesses the system and depending on the configuration and return me a subclass of it. The main idea and the class was abstract his own factory, and returns to a sub-class as needed, depending on the config system.
I represented my idea into a draft in C + +, not necessarily to be something specific to him, but for a general approach for other language like java, etc..
is possible?
Example:
class system {
public:
Config config;
}
class Base {
public:
Base() {
if(System.getInstance().config == Config.FooMode) {
Foo foo = new Foo();
return foo;
}
};
};
class Foo: public Base {
public:
float a;
float b;
float c;
}
class Boo: public Base {
public:
float d;
float f;
float g;
}
int main() {
Point point = new Point();
return 0;
}