How do you prevent a class from being inherited in c#?
Answer / Vivek Gupta
In C#, you can prevent a class from being inherited by making it an abstract class or by using the sealed keyword. To make a class an abstract, use the 'abstract' keyword before its declaration, which means that the class cannot be instantiated and must be inherited by another class. To seal a class, use the 'sealed' keyword before the class declaration, indicating that it cannot be further subclassed.
| Is This Answer Correct ? | 0 Yes | 0 No |
What do you understand by 'access specifiers' in C#?
Can you mark static constructor with access modifiers?
What is a concrete class in c#?
How many catch blocks can be there for a single try block?
What is the implicit name and type of the parameter that gets passed into the class set method?
localization using windows c#
How do you comment out code in c#?
Is there hashmap in c#?
why we can't create an object for a static class?? what is the reason behind this?
What is Serialization and how do we implement (in real time scenario)
What is eager and lazy loading in c#?
What is cosole application?
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)