回复:有人能答出这到.NET的题吗?非常TRICKY哟

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

所有跟帖: 

这位朋友的确很牛 -牛牛哥- 给 牛牛哥 发送悄悄话 牛牛哥 的博客首页 (61 bytes) () 09/14/2009 postreply 08:15:30

实际上这个不是完全可以的 -st.paul- 给 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- 给 st.paul 发送悄悄话 (206 bytes) () 09/14/2009 postreply 13:17:12

不可以加NEW啊 -牛牛哥- 给 牛牛哥 发送悄悄话 牛牛哥 的博客首页 (77 bytes) () 09/14/2009 postreply 19:13:44

回复:要略改动才可以 (加new keyword) -Largo- 给 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

请您先登陆,再发跟帖!