Monday, 24 June 2024

What is static

  • A static class cannot contain any non-static members except const and enum.
  • A static class cannot inherit from other classes except the Object class. 
  • A static classes cannot implement interfaces. 
  • A static classes cannot be inherited because they are implicitly sealed by default. 
  • A static class cannot contain any instance constructors. 
  • A static class cannot be explicitly marked as sealed because it is already sealed by default. 
  • A static class can contain enums. explicit private constructors are not allowed in a static class. 
  • Only a static constructor (implicitly private) can be defined. 
  • A static class cannot be instantiated; it is implicitly abstract. 
  • A non-static class can contain static methods. 
  • A static method can be accessed using the class name itself, without creating an object of the class. 
  • A non-static class can also contain a static constructor. 
  • A static class cannot contain any destructor. an indexer cannot be defined in a static class because indexers cannot be static.
Share:

0 Comments:

Post a Comment