C# Programming - Inheritance - Discussion

Discussion Forum : Inheritance - General Questions (Q.No. 12)
12.
How can you prevent inheritance from a class in C#.NET ?
Declare the class as shadows.
Declare the class as overloads.
Declare the class as sealed.
Declare the class as suppress.
Declare the class as override.
Answer: Option
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.
Discussion:
1 comments Page 1 of 1.

Sridhar said:   7 years ago
How?

The sealed class will not participate in inheritance.

Post your comments here:

Your comments will be displayed after verification.