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 difference between dll and exe in c#?
What are async and await?
Why is c# better than java?
is it possible to access a remote web service Without UDDI?
Why can?t you specify the accessibility modifier for methods inside the interface?
What is virtual in c#?
What is the usage of transponders?
What are the advantages of interface in c#?
What is the process of delegation?
What is tpl in c#?
How do I type a whitespace character?
What is constants in c#?