views:

131

answers:

2

If one can prevent subclassing by declaring private constructor in the base class, why do we need "sealed" keyword? Is it so because CLI can optimize it better? maybe.

Thanks.

+6  A: 

Because you might want to have public constructors but not allow anyone to derive from your class

Sean
+2  A: 

If a class is sealed some optimizations can be performed. i.e. the clr could emit .call instruction rather than a .callvirt

MaLio