这个作业对于理解C#的多态十分重要,
不能代写

解决方案 »

  1.   

        public delegate void mydelete();
        class Program
        {       public abstract  class car
            {            public int wheel;
                public double height;
                public car(int wheel, double height)
                {
                    this.wheel = wheel;
                    this.height = height;
                
                
                }
                public abstract void speak();      
                    }        class bus:car
            {
                public int people;
                public int a;
                public int b;
                public bus(int  wheel,double height,int people)
                :base(wheel,height)
                {                this.wheel = wheel;
                    this.height = height;
                    this.people = people;
                
                
                }            public override void speak()
                {
                    Console.WriteLine("bus虚方法吧!");
                }
                      }        static void Main(string[] args)
            {            mydelete a = () => 
                {                
                    car[] op = new car[1] { new bus(4,23.2,30)};
                    for (int i = 0; i < 1; i++)
                    {
                        op[i].speak();
                    
                    }
                
                
                };
                a();
              
                Console.ReadKey();