OOPを使用できます。残念ながら、使用するプログラミング言語を提供していません。
たとえば、C でプログラミングしている場合は、次のようにすることができます。
struct thefunctions {
void (*stuff1)(void);
void (*stuff2)(int);
int (*get)(int);
};
struct thefunctions network {
.stuff1 = doSomething;
}
struct thefunctions standalone {
.stuff1 = doSomethingCompletelyDifferent;
}
struct thefunctions * funcs;
[...]
if (host) {
funcs = &network;
} else {
funcs = &standalone;
}
// now the structs are initialized. We can now use funcs->.
[...]
// If I am sure that stuff1 has been initialited properly, I can do
funcs->stuff1();
// If not, I should check first
if (funcs->stuff1) funcs->stuff1();
// or
assert(funcs->stuff1);
funcs->stuff1();