Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top