C#面向对象基础(六) 继承
摘要:
继承描述的是is a kind of 的关系.比如:Animal类 wolf类. Wolf类是Animal类的子类,Animal类是父类.Wolf类从Animal类派生,Wolf类继承了Animal类Wolf是一种Animal.失败的设计:1publicclassWolf2{3publicstringname;4publicintage;5publicboolishungry;6privateintweight;7publicvoidSleep()8{9Console.WriteLine("睡觉...");10}11publicvoidEat()12{13Console.W 阅读全文
posted @ 2011-09-08 16:05 言午 阅读(313) 评论(0) 推荐(1) 编辑