0

Possible Duplicate:
Why seal a class?

I haven't seen a lot of classes with this modifier, however I'm wondering in which kind of scenarios this would be useful.

Community
  • 1
  • 1
kerzek
  • 490
  • 1
  • 5
  • 15

1 Answers1

0

In case you do not wand anyone to extend a class.

Classic example is a String class, it's self-sufficient and implements flyweight pattern, that might be easily destroyed if anyone could overwrite it's methods/properties.

You want to use the sealed class if you provide your API that doesn't need to be changed, for any of above reasons.

Anton
  • 1,409
  • 1
  • 19
  • 37