C#?й??????????????????÷?

????????????????????????????

?????????C????????????C#??????????????????????????C#??????????????????????鸚???????????????????????е?????????????????????????????????????????鰱???????????????????????“????”???????“??????”???λ?????????????????????????????ú?????????????

??????????飬?????????????????????????????б?????????????????????????????????????????????????????????????????????????C#????????????????????????????????????????????????????????У???????????????????????С???????????????????????????С?????????????????????????????С???????????????????????????????????

????????????????C#?е?????

?????????????????????????????????????ó????????????С???????????????????????ù???????????????????????????????????????????????з?????????????????????void????????????????з??????????????????????????????????????????????????????κ????????????? ???????е???????????????????????????????????д?????????????????????????????????

????class TestClass { ??public TestClass(): base() {} // ??CLR?? }

?????????о????????????????

????1??????????

????class TestClass { ??public TestClass(): base() {} }

??????????????????????CLR??????

????2???????????

?????????????????????????????г???????????????磺

using System; class Point { ??public double x?? y; ??public Point() ??{ ????this.x = 0; ????this.y = 0; ??}
public Point(double x?? double y) ??{ ????this.x = x; ????this.y = y; ??} ??… }
class Test { ??static void Main() ??{ ????Point a = new Point(); ????Point b = new Point(3?? 4); // ?ù????????????????… ??} }

???????????????Point???????????????????????????????????????в?????Point???????????????????double??????Point??????????????????????Щ?????????????CLR?????????????????????????????????????????????????Point()??Point(double x?? double y)???????????????????????????????


3?? ?????????

??????????????????????????г???????????????????????????????????????????????????в??????????????η????????????????????????????????????????????á??磺

????using System.Data; class Employee { ??private static DataSet ds; ??static Employee() ??{ ????ds = new DataSet(...); ??} ??... }

??????????????о????????????Employee???????????????????????????г?????????????????????????г??????????????????????????????????????????????????????????г??????

?????????????????????????????????private?????????private TestClass() {…}??????private??ζ?????????治???????ù????????????????????????????ж????????????????????

?????????????????????????????????潫???????????????ν??У?????н??У??????????????????????÷??????????????????????????????????????????????????????????????????????????????????????????

??????????????????????????????????????????????????????????? ????????д??????????л??????????????????????????????????????????ж?????????????л???????????????г???????????????????????????????????

??????????л?????????????????????????л??????ι?????????????л?????вι???????????????????????????????????????????磺

class A { private int x; ??public A( ) { x = 0; } ??public A( int i ) { x = i; } };
class B : A { private int y; ??public B( ) { y = 0; } ??public B( int i ) { y = i; } ??public B( int i?? int j ):A(i) { y = j; } };
B b1 = new B();
//??л???A???????A()???????????????????B() B b2 = new B(1);
//??л???A???????A()???????????????????B(int) B b3 = new B(0??1);
//?????л???A???????A(int) ??????????????
??????????B(int??int)

??????????????????д??????????????????????????????A?????????ι?????public A( ) { x = 0; }????????????????й????????????????б??????????A???вι?????A(i)???????????

class A { private int x; ??public A( int i ) { x = i; } };
class B : A { private int y; ??public B():A(i) { y = 0; } ??public B(int i):A(i) { y = i; } ??public B(int i?? int j):A(i) { y = j; } };