Home > Articles > Programming > Windows Programming

  • Print
  • + Share This
This chapter is from the book

4.5 Static Class Design

A static class is defined as a class that contains only static members (of course besides the instance members inherited from System.Object and possibly a private constructor). Some languages provide built-in support for static classes. In C# 2.0, when a class is declared to be static, it is sealed, abstract, and no instance members can be overridden or declared.

public static class File {

If your language does not have built-in support for static classes, you can declare such classes manually as in the following C++ example:

public class File abstract sealed {

Static classes are a compromise between pure object-oriented design and simplicity. They are commonly used to provide shortcuts to other operations (such as System.IO.File), or functionality for which a full object-oriented wrapper is unwarranted (such as System.Environment).

  • + Share This
  • 🔖 Save To Your Account