虚函数和抽象函数的区别
摘要:虚函数是有代码的并明确允许子类去覆盖,但子类也可不覆盖,就是说可以直接用,不用重写抽象函数是没有代码,子类继承后一定要重写 在一个类中用虚函数:是因为在超类中的有实际代码的方法,但明确允许子类可以作重写而且当子类重写后,可以用子类实例超类;如果这样,超类变量调用虚函数时,执行的是子类的方法在一个类...
阅读全文
posted @
2007-03-26 15:32
culffe
阅读(499)
推荐(0)
c#中的interface abstract与virtual
摘要:interface用来声明接口1.只提供一些方法规约,不提供方法主体 如 public interface IPerson{ void getName();//不包含方法主体 }2.方法不能用public abstract等修饰,无字段变量,无构造函数。3.方法可包含参数 如 public in...
阅读全文
posted @
2007-03-26 15:10
culffe
阅读(103)
推荐(0)
.NET Delegates: A C# Bedtime Story
摘要:.NET Delegates: A C# Bedtime Story Tight Coupling Once upon a time, in a strange land south of here, there was a worker named Peter. He was a diligent...
阅读全文
posted @
2007-02-13 17:43
culffe
阅读(186)
推荐(0)