如果不改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