多态(虚方法)
摘要:
使用虚方法实现“多态”背景:classAnimal{publicstringname;publicintage;publicfloattemperature;publicvoidEat(){Console.WriteLine("Animal吃东西");}}classWolf:Animal{publicstringcolor;publicvoidhunt(){}publicvoidEat(){Console.WriteLine("Wolf吃羊");}}classFish:Animal{publicvoidSwim(){}publicvoidEat(){Co 阅读全文
posted @ 2012-04-11 16:47 言午 阅读(245) 评论(0) 推荐(0) 编辑