From course:
(Practice similar questions for free)
Advanced Concept C# Interview Questions
» Start this Course(Practice similar questions for free)
Question:
What is a sealed method in C# and when would you use it?
Author: Lock HuynhAnswer:
A sealed method in C# is a method that cannot be overridden by derived classes. It is used in a class that inherits from a base class to prevent further overrides of a specific method that has already been overridden. You would use a sealed method to ensure the current implementation of the method is preserved and not altered in further subclasses, enhancing security and maintaining consistency in behavior.
0 / 5 Â (0 ratings)
1 answer(s) in total