我需要从一个特定的方法限制方法的调用。
I need to restrict the calling of a method from a particular method.
例如:
我已经喜欢函数的GetData()
,我需要它的调用方法的签名是
无效 SomeFUnction(字符串,字符串B)
否则的话的GetData 不应该被允许在编译时间本身。
I've a function like GetData()
and I need its calling method's signature to be
void SomeFUnction(string a, String b)
otherwise the calling of GetData
should not be allowed at compile time itself.
如果你只是想限制的GetData,可以从SomeFuncion(......)之称,那么你可以很容易地做到这一点通过封装的方法在一个类(例如/静态),并使得的GetData方法私有的,只能从SomeFunction(......)称呼它。你怎么还能在编译时限制此!!
If you just want to restrict that "GetData" could be called from "SomeFuncion(...)", then you can easily do that by encapsulating your method in a class (instance/static) and making the "GetData" method private, and only call it from your "SomeFunction(...)". How else could you restrict this at compile time!!.
不过,我相信你没有共享的具体问题发言在这里。 相反,你是你percieve作为一种可能的解决问题的方法分享一个想法!。
Though, I believe you are not sharing the exact problem statement here. Instead, you are sharing a thought that you percieve as a possible solution to your problem!!.
共享的具体问题陈述去给你更好的答案。
Sharing the exact problem statement will fetch you better answers.
上一篇:HTML 的输入类型 =“密码"的 Windows 批处理等效项是什么?批处理、密码、类型、HTML
下一篇:如何使用 WAMP 登录 phpMyAdmin,用户名和密码是什么?如何使用、用户名、密码、phpMyAdmin