Jon Jagger
jon@jaggersoft.com
Table of Contents 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 Notes DownloadECMA-334 C# Language Specificationpreviousnextprevious at this levelnext at this level 11 Typesprevious at this levelnext at this level 11.1 Value typesprevious at this levelnext at this level 11.1.1 Default constructors Paragraph 11 All value types implicitly declare a public parameterless instance constructor called the default constructor. Paragraph 21 The default constructor returns a zero-initialized instance known as the default value for the value type: Paragraph 31 Like any other instance constructor, the default constructor of a value type is invoked using the new operator. [Note: For efficiency reasons, this requirement is not intended to actually have the implementation generate a constructor call. end note] 2 In the example below, variables i and j are both initialized to zero.
class A  
{  
   void F() {  
      int i = 0;  
      int j = new int();  
   }  
}  
Paragraph 41 Because every value type implicitly has a public parameterless instance constructor, it is not possible for a struct type to contain an explicit declaration of a parameterless constructor. 2 A struct type is however permitted to declare parameterized instance constructors (§18.3.8).
{ JSL }
Jagger Software Ltd
Company # 4070126
VAT # 762 5213 42
Valid HTML 4.01Valid CSS