2012年8月16日
摘要: 类与结构的实例比较 类与结构的差别 如何选择结构还是类一.类与结构的示例比较: 结构示例: public struct Person { string Name; int height; int weight public bool overWeight() { //implement something } } 类示例: public class TestTime { int hours; int minutes; int seconds;public void passtime() { //implementation of behavior } } 调用过程: public class 阅读全文
posted @ 2012-08-16 16:09 shinecao 阅读(175) 评论(0) 推荐(0) 编辑
摘要: 一:abstract 修饰符可以和类、方法、属性、索引器及事件一起使用。在类声明中使用 abstract 修饰符以指示某个类只能是其他类的基类。标记为抽象或包含在抽象类中的成员必须通过从抽象类派生的类来实现。 abstract class ShapesClass { abstract public int Area(); } class Square : ShapesClass { int side = 0; public Square(int n) { side = n; } // Area method is required to avoid a compile-time error. 阅读全文
posted @ 2012-08-16 10:30 shinecao 阅读(216) 评论(0) 推荐(0) 编辑