摘要:
using System;using System.Collections.Generic;using System.Linq;using System.Text;//如何运行前不知道的值传递给 CommandDelimitedFile构造器?答案:使用静态方法,与base关键字一起使用。namespace InitialConstruct{ class CommandDelimitedFile { public CommandDelimitedFile(string fileName) { Console.WriteLine("[CommandDelimitedFile." 阅读全文
posted @ 2011-03-04 22:34
焦涛
阅读(253)
评论(0)
推荐(0)
摘要:
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace InitialConstruct{ class BaseClass { public BaseClass() { Console.WriteLine("[BaseClass.BaseClass] " + "Construct called"); } public BaseClass(int foo) { Console.WriteLine("[BaseClass. 阅读全文
posted @ 2011-03-04 21:45
焦涛
阅读(371)
评论(0)
推荐(0)
摘要:
using System;using System.Collections.Generic;using System.Linq;using System.Text;//构造器初始化//1.派生类构造器调用基类构造器(除System.Object构造器外,所有C#对象都在执行构造器的第一行代码之前调用基类构造器)//2.初始化器的两种形式:// (1)base() 调用当前类的基类构造器// (2)this() 可以让当前类调用自身中定义的另一个构造器namespace InitialConstruct{ class BaseClass { public BaseClass() { Consol 阅读全文
posted @ 2011-03-04 20:55
焦涛
阅读(251)
评论(0)
推荐(0)
摘要:
using System;using System.Collections.Generic;using System.Linq;using System.Text;//静态成员//1.只存在此成员的一个副本//2.当包含在这个类的应用程序被装载时,才创建静态成员//3.在应用程序的整个生存周期内存一直存在。//4.是值类型:静态成员必须有合法的值namespace StaticMember{ class InstCount { public InstCount() { instanceCount++; } static public int instanceCount; } class Pro 阅读全文
posted @ 2011-03-04 19:43
焦涛
阅读(154)
评论(0)
推荐(0)
浙公网安备 33010602011771号