What is the purpose of “sealed” in C# when “virtual” is optional

  • Thread starter Thread starter Myprogrammer
  • Start date Start date
M

Myprogrammer

Guest

You can override a virtual method or property and seal it so that it cannot be overridden further in the inheritance hierarchy. That is the use of sealed methods.

But what would be the use of sealed classes.I know that sealed classes cannot be inherited but what is the point when we have an optional virtual .When we do not mention virtual then the derived class method cannot be overriden right ?


Continue reading...
 
Back
Top