Home » C# Programming » Inheritance

How can you prevent inheritance from a class in C#.NET?

Correct Answer: Declare the class as sealed.

Explanation:

C#.NET allows sealed attribute to be used as a part of class statement. Classes declared with sealed keyword cannot be used as based class for other classes. Most important reason to do this world be to prevent behavior of a class to be changed in any way.

← Previous Question Next Question→

More Questions from Inheritance

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion