Go through Static class example

/// /// Static Class /// /// You can not Initiate : A obj = new A(); /// You can not Inherited : class B : A { } /// All the members in Static class are static /// They cannot contain Instance Constructors : public A { } /// /// static class A { /* Error 'test': cannot declare instance members in a static class public void test() { } */ public static void test() { } } /*Error cannot derive from static class 'OOPS_Concept.Program.A' class B : A { } */ static void Main(string[] args) { /* Error 1 Cannot declare variable of static type 'OOPS_Concept.Program.A' Error 2 Cannot create an instance of the static class 'OOPS_Concept.Program.A' A obj = new A();*/ A.test(); }

Comments

Popular posts from this blog

How to get motherboard serial number, Processor ID, VolumeSerialNumber using C#?

Fiserv Interview Questions.

AngularJs - Simple Example