Win Prizes

Social Presence
Twitter Twitter LinkedIn YouTube Google

Like us on Facebook
Top Articles Author
Fri, 25-Jul-2014 Authors
All Time Authors
Bharathi Cherukuri

Latest members | More ...

(Statistics delayed by 5 minutes)

Difference between sealed and static classes

 Posted by Ddd on 2/2/2011 | Category: OOPS Interview questions | Views: 6304 | Points: 40


sealed classes:

1)we can create their instances, but cannot inherit them


sealed class demo


class abc:demo
2)They can contain static as well as nonstatic members.

static classes:

1)we can neither create their instances, nor inherit them

static class Program


2)They can have static members only.

Asked In: Many Interviews | Alert Moderator 

Found interesting? Add this to:

Comments or Responses

Posted by: Umarali1981 on: 8/9/2012 | Points: 10

Also, include the below one as third point,

3)Static classes are used when a class provides functionality that is not specific to any unique instance.

3)Sealed classes are mainly used to prevent inheritance features of object oriented programming.

Posted by: Singhmanish2211 on: 8/3/2013 | Points: 10

One thing is missing about when to use sealed class and when to use static class in all the forums :

If you want your class to have different behavior's for their instances go for sealed class whereas if you want a unique behavior for the instances of your class go for static class were only one instance will be available at any given time.

Login to post response