Three ways to restrict a class from being inherited?
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.
Know the answer? Post it. Somebody with the same question will find it here.
Marcel van Driel2 pointsPosted May 16, 2009, 3:52 AM EDT
- 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.
1 short reply
Yash2 pointsPosted May 17, 2009, 1:20 AM EDT