Why sealed and singleton?

751 views Asked by At

Possible Duplicate:
Purpose of final and sealed

Hi all,

When should we opt for designing a sealed class?

When should we opt for designing a singleton class?

1

There are 1 answers

0
Gerry On BEST ANSWER

These are two unrelated uses of a class.

A singleton should be used when you know that you will have exactly one instance of the class during its execution.

A sealed class simply means that it cannot be subclassed (or inherited). I don't know when it is good situation to mark a class as sealed, so I never do.