首页 > 代码库 > 抽象类和抽象方法

抽象类和抽象方法

using System; using System.Collections.Generic; using System.Linq; using System.Text;

namespace ConsoleApplication1 {     class Program     {         static void Main(string[] args)         {             Myclasstwo Myclass=new Myclasstwo() ;             int number=Myclass.meas();             Console.WriteLine(number);             Console.ReadKey();         }     }     abstract class Myclassone     {         protected int numberone = 10;         protected int numbertwo = 20;         public abstract int meas();         public abstract int Numberone { get; }         public abstract int Numbertwo { get; }     }     class Myclasstwo : Myclassone     {         int ruselt;         public override int meas()         {             Myclasstwo myclass = new Myclasstwo();             ruselt = myclass .Numberone+myclass .Numbertwo ;             return ruselt;         }         public override int Numberone         {             get             {                 return numberone+1;             }         }         public override int Numbertwo         {             get             {                 return numbertwo+2;             }         }     } }