Monday, June 24, 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.

No comments :

Post a Comment

AJAX, asp, Asp.net, asp.net and sql server security, Asp.net IntemIndex, C#, Css, DataBinder.Eval, DataKeyNames, Datalist, Datapager, DataSet, DataTable, DropDownList, FindControl, gridview, JavaScript, jquery, Listview, Paging, Regex, RegularExpression, Repeater, Server side validation, Sql Server, timer, timercallback, Validation, XML, xmlnode, XPath