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 17 Classesprevious at this levelnext at this level 17.10 Instance constructorsprevious at this levelnext at this level 17.10.5 Private constructors Paragraph 11 When a class declares only private instance constructors, it is not possible for other classes to derive from that class or to create instances of that class (an exception being classes nested within that class). [Example: Private instance constructors are commonly used in classes that contain only static members. For example:
public class Trig  
{  
   private Trig() {}   // Prevent instantiation  
   public const double PI = 3.14159265358979323846;  
   public static double Sin(double x) {...}  
   public static double Cos(double x) {...}  
   public static double Tan(double x) {...}  
}  
The Trig class groups related methods and constants, but is not intended to be instantiated. Therefore, it declares a single empty private instance constructor. end example] 2 At least one instance constructor must be declared to suppress the automatic generation of a default constructor.
{ JSL }
Jagger Software Ltd
Company # 4070126
VAT # 762 5213 42
Valid HTML 4.01Valid CSS