Search
Submit & Win
Submit and win
Cash Prizes !
Winners

Win Prizes

Social Presence
Twitter Twitter LinkedIn YouTube Google

Like us on Facebook
Advertisements
Top Articles Author
Sat, 20-Dec-2014 Authors
All Time Authors
Vishal@Neeraj
43920
Rajkatie
20680
Bharathi Cherukuri
18040

Latest members | More ...


(Statistics delayed by 5 minutes)
 Interview Question

Difference between sealed and static classes

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

Answer:

sealed classes:

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

ex:

sealed class demo
{

}

class abc:demo
{
--Wrong
}
2)They can contain static as well as nonstatic members.

static classes:

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

ex:
static class Program
{

}

2)They can have static members only.


Asked In: Many Interviews | Alert Moderator 

Share this to:

Bookmark It

Comments or Responses

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