New answers tagged

7

As Anders says, its partly about performance and partly about locking down poorly-thought designs down to reduce the scope of trouble caused later by people blindly inheriting things that were not designed to be inherited. Performance seems obvious - while most methods wont be noticed on modern hardware, a virtual getter might cause quite a noticeable hit, ...


6

There's two elements to your question, so I'll try and address them in turn: Why aren't .NET methods virtual by default? Inheritance, in practice, has many problems. So if it is to be used as part of a design, then it should be carefully considered. By making methods non-virtual by default, the theory is that it encourages the developer to think about ...



Top 50 recent answers are included