第一学期。第一节课:接口

学的东西不解释啊。有的不会。。。我也问问别人吧。

哎第一天上课,昨天的的课所以没听。因为没来。今天学起来很惆怅啊。住

了一个多月院。。。花了三万块钱还有。。我的暑假。。。在省二院见到好

多糖尿病的人。发现自己还算好的呵呵。不过耽误学校一些事情也算解决了

。哎现在我很穷了呵呵。还是把今天学的东西记到博客上吧。以后也许会看

看呢。
namespace InterfaceDemo
{
    class Program
    {
        static void Main(string[] args)
        {

            int[] pins=new int[4]{4,8,5,9};
           
            int[] copy = new int[pins.Length];
            pins.CopyTo(copy, 0);
          
            foreach (int i in copy)
            {
                Console.WriteLine(i);
            }
            pins[0] = 99999;
            foreach (int i in copy)
            {
                Console.WriteLine(i);
            }
            Console.WriteLine

("")

;

 


           // int[] ailas = pins;

           // for (int i = 0; i < pins.Length; i++)
           // {
           //     ailas[i] = pins[i];
           // }


           //     foreach (int i in ailas)
           //     {
           //         Console.WriteLine(i);
           //     }

           // pins[3] = 10000;

           // foreach (int i in ailas)
           // {
           //     Console.WriteLine(i);
           // }


           // int[] arry = new int[10];
           // int number=0;

           // for (int i = 0; i < arry.Length; i++)
           // {
           //     number = number + 10;
           //     arry[i] = number;
           // }

           // foreach (int i in arry)
           // {
           //     Console.WriteLine(i);
           // }

 

           // Horse horse = new Horse("斑马维尼");
           //Console.WriteLine( horse.getName());
           // horse.ChrewGrass();

           // Sheep sheep = new Sheep("绵羊妮妮");
           // Console.WriteLine(sheep.getName());
           // sheep.ChrewGrass();

           // Cow cow = new Cow("小牛麦克");
           // Console.WriteLine(cow.getName());
           // cow.ChrewGrass();

           // BanBa banMa = new BanBa("littleBM");
            //banMa.Trot();
           // IJourney journeyHorse = horse;
           // int legs= journeyHorse.NumberOfLegs();
           // Console.WriteLine(legs);

           // ILandBound landHorse = horse;
           //legs=landHorse.NumberOfLegs();

           //Console.WriteLine(legs);


            //ILandBound landbound = horse;
            //Console.WriteLine( landbound.NumberOfLegs());
            //这里可以把接口看成广义上的父类,以上这例子就是父类

引用子类对象

            Console.ReadKey();
        }
    }
}

 

    class Mammal
    {
        private string name;
        public string getName()
        {
            return name;
        }
        public Mammal(string initialName)
        {
            name = initialName;
        }
        public void Breath()
        {
            Console.WriteLine(name+"这个哺乳动物正在呼吸");
        }
        public void SunkleYoung()
        {
            Console.WriteLine(name+"这个哺乳动物正在哺乳");
        }
    }
没什么改动。因为我怕该错了。呵呵以后要是自己看到要记得努力哦。

加油!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值