不知道標題突出了我的目標。編譯時間動態函數調用
我可以動態調用在編譯時的方法? 例如:
int CallMethod(string methodName, string methodArg)
{
Foo foo;
return foo.#methodName(methodArg);
}
CallMethod("getValue", "test"); // This would attempt to call on a Foo instance, method getValue with argument "test" -- foo.getValue("test");
謝謝!
沒有,使用的模板或宏。 – Pubby
是您的函數名稱將是編譯時間字符串字面就像你在你的例子發佈或正在打算從文件/讀取用戶輸入等? –
@Karthik T:字符串字面 – codeJack