Sealed Class Example

/// /// Sealed Class /// /// You can Initiate the class /// You can not Inherit the class : class B : A { } /// Structs are implicitly sealed; therefore, they cannot be inherited. /// System.Threading.Thread /// /// sealed class A { public A() { } public void Test1() { } public static void Test2() { } } /*//Error : 'OOPS_Sealed.Program.B': cannot derive from sealed type 'OOPS_Sealed.Program.A' class B : A { }*/ static void Main(string[] args) { A obj = new A(); A.Test2(); }

Comments

Popular posts from this blog

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

Fiserv Interview Questions.

AngularJs - Simple Example