Skip to content

Three ways to restrict a class from being inherited?

Yash

Asked May 14, 2009, 10:56 PM EDT2 answers
Share
LinkedInX
I need to know at least three ways to restrict a class from being inherited

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0

    - Declare it sealed (most obvious solution)

    - If it's in another assembly, don't make it public (can't inherit what you can't see).

    - You also cannot inherit from a static class.

    Not sure if this answers your question, but there you go.

    0
  • 1 short reply
    • 0
      Thanks Marcel.
      0