In C#, which keyword is used to indicate that a class cannot be inherited by…
2025
In C#, which keyword is used to indicate that a class cannot be inherited by other classes?
- A.
sealed
- B.
final
- C.
private
- D.
static
Attempted by 238 students.
Show answer & explanation
Correct answer: A
The question is specifically about C#.
In C#, the sealed keyword is used to prevent a class from being inherited. A sealed class cannot be used as a base class for another class.
The final keyword can serve a similar purpose in Java, but it is not the C# keyword for this concept.
private controls accessibility, and static does not mean that an ordinary class cannot be inherited.
Correct Answer: Option A (sealed).