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 |
Explain the top reason to use c# language?
Can you describe iuknown interface in short?
update data in an xml file which resides in solution itself, using silverlight 4.0
What are examples of desktop applications?
How to find the current application file path while runtime?
What are scriptable objects?
Explain the difference between boxing and unboxing.
Why objects are stored in heap in c#?
Is it possible to restrict the scope of a field/method of a class to the classes in the same namespace?
How do I create a single-file assembly?
My switch statement works differently! Why?
What is binary search tree in data structure?
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)