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?

  1. A.

    sealed

  2. B.

    final

  3. C.

    private

  4. 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).

Explore the full course: Bpsc