Plz.......
how will we call abstract class without inherit class?
how will we restrict inherit class without sealed?
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
VulpesRank #55 · 29.2K reputationPosted Oct 27, 2014, 10:54 AM EDT
However, abstract classes can also include static members and, provided these are public or internal, you can access them from a non-derived class.
You can effectively prevent a class from being inherited from without the use of the sealed keyword by giving it only a private constructor. This won't be accessible from derived class constructors which always need to, implicitly or explicitly, call their base class's constructor. Consequently, any attempt to create a derived class will fail in these circumstances.
Ajay YadavRank #313 · 8.1K reputationPosted Oct 27, 2014, 6:16 PM EDT
Arunava BhattacharjeeRank #635 · 3.8K reputationPosted Oct 27, 2014, 7:57 PM EDT
2. You can make the class as "Static" or you can make the constructor as "Private"
If this answers your question, please mark it as accepted.