一直都是人云亦云的敲code,除了会一些业务上的逻辑,也没什么了, 连C# 面向对象编程都不理解,自己怎么学到这个份上了, oop?? public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { //继承 多态 封装 Animal[] aItem=new Animal[2]; aItem[0] = new Dog("dog"); aItem[1] = new Cat("cat"); foreach (Animal item in aItem) { Response.Write(item.jiao()); } } public class Animal { public Animal() { //构造函数 } public virtual string jiao() { return ""; } } public class Dog : Animal { private string str = ""; public Dog(string s) { str = s; } public override string jiao() { return str; } } public class Cat : Animal { private string str = ""; public Cat(string s) { str = s; } public override string jiao() { return str; } } } 2009-08-08 自己写出来了,但虫没有实战应用过, 就是不知道为什么这么些,哪有好处呢, 有待慢慢理解 实际工作中,预见的业务也没有这么规规矩矩的啊? 困惑(⊙o⊙)