码迷,mamicode.com
首页 > 其他好文 > 详细

DoSomething

时间:2015-02-26 09:49:10      阅读:82      评论:0      收藏:0      [点我收藏+]

标签:

using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Test {     public interface IMyInterface     {         void DoSomething();         void DoSomethingElse();     }     public class MyBaseClass : IMyInterface     {         #region IMyInterface 成员         public virtual void DoSomething()         {             Console.WriteLine("MyBaseClass中的DoSomething");         }         public virtual void DoSomethingElse()         {             Console.WriteLine("MyBaseClass中的DoSomethingElse");         }         #endregion     }     public class MyDerivedClass : MyBaseClass     {         public new void DoSomething()         {             Console.WriteLine("MyDerivedClass中的DoSomething");         }         public override void DoSomethingElse()         {             Console.WriteLine("MyDerivedClass中的DoSomethingElse");         }     }     class Program     {         static void Main(string[] args)         {             //---------------------------------------------------             MyDerivedClass d = new MyDerivedClass();             d.DoSomething();             Console.WriteLine(new String(‘-‘, 50));             //---------------------------------------------------             MyBaseClass mybase = new MyBaseClass();             mybase.DoSomething();             Console.WriteLine(new String(‘-‘, 50));             //---------------------------------------------------             IMyInterface im = d;             im.DoSomething();             Console.WriteLine(new String(‘-‘, 50));             //---------------------------------------------------             //im = mybase;             //im.
            Console.ReadKey();         }     } }

DoSomething

标签:

原文地址:http://www.cnblogs.com/icedlemon/p/4300577.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!