如果不改MyClass, 可用 Reflection/Delegate. Some Delegate sample:
MyDel del = (MyDel)Delegate.CreateDelegate(typeof(MyDel),new MyClass.Animal(), "Eat");
del.GetType().BaseType.GetField("_target", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(del,null);
del();
回复:有人能答出这到.NET的题吗?非常TRICKY哟
所有跟帖:
•
这位朋友的确很牛
-牛牛哥-
♀
(61 bytes)
()
09/14/2009 postreply
08:15:30
•
实际上这个不是完全可以的
-st.paul-
♂
(850 bytes)
()
09/14/2009 postreply
09:35:38
•
实际上是要HACK V-TABLE,我也没搞出来,也没资料找
-牛牛哥-
♀
(0 bytes)
()
09/14/2009 postreply
19:15:51
•
要略改动才可以 (加new keyword)
-st.paul-
♂
(206 bytes)
()
09/14/2009 postreply
13:17:12
•
不可以加NEW啊
-牛牛哥-
♀
(77 bytes)
()
09/14/2009 postreply
19:13:44
•
回复:要略改动才可以 (加new keyword)
-Largo-
♂
(185 bytes)
()
09/14/2009 postreply
19:53:32
•
不是在CLASS LEVEL CALL BASE.EAT(), 要求在OBJECT上
-牛牛哥-
♀
(143 bytes)
()
09/14/2009 postreply
20:07:08