Why aren’t classes sealed by default?

I’d say it was just a mistake. I know many people (including myself) who believe that classes should indeed be sealed by default. There are at least a couple of people in the C# design team in that camp. The pendulum has swung somewhat away from inheritance since C# was first designed. (It has its place, of course, but I find myself using it relatively rarely.)

For what it’s worth, that’s not the only mistake along the lines of being too close to Java: personally I’d rather Equals and GetHashCode weren’t in object, and that you needed specific Monitor instances for locking too…

Leave a Comment