Can you prevent a class from overriding?
Answers were Sorted based on User's Feedback
Answer / techy_unknown
Hi,
I think the question itself is illogical.
The term "overriding" is ONLY and ONLY associated with
methods/properties not to the class.
So, if the question is put a like, "How to prevent methods
not to be overriden?" then the answer is: "Make them non-
virtual."
And if the question is put a like, "How to prevent the
inheritance for a specific class?" then the answer
is, "Make the calss sealed."
I really hope that the reply makes sense here.
| Is This Answer Correct ? | 38 Yes | 1 No |
Answer / nazrul
we can use sealed keyword at the time of declartion of class
thorugh which it won't inherit and won't be overide.
| Is This Answer Correct ? | 4 Yes | 6 No |
What is a bool in c#?
what is the Difference between the public and private ?
How u call destructor and dispose methode in c#.NET
What do you mean by for each loop?
What is the execution entry point for a c# console application?
How to transpose multi-dimensional array?
Why we use get and set method in c#?
Which program construct must return a value?
an object,class is value type or refarance type. ?
What is difference between int and int32 in c#?
if we are updating a database using thread, and mean while application crashes or thread being aborted then what will happen in Database? Rollback or Database will be updated? Please explain with different scenario.
What is .dbml file?
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)