Can you prevent a class from overriding?

Answers were Sorted based on User's Feedback



Can you prevent a class from overriding?..

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

Can you prevent a class from overriding?..

Answer / aa

make the class sealed

Is This Answer Correct ?    6 Yes 7 No

Can you prevent a class from overriding?..

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

Post New Answer

More C Sharp Interview Questions

Explain the difference between a namespace and assembly name in .net?

0 Answers  


Is array a list?

0 Answers  


in a town the percentage of total men is 52. the percentage of total literacy is 48. if total percentage of literate men is 35 of total population. write a program to find out the total no of illiterate men and women.

3 Answers   HCL,


Where do we use static class in c#?

0 Answers  


What is difference between variable and property in c#?

0 Answers  






what is a callback function?

4 Answers  


What is a variable in c#?

0 Answers  


How do I port "synchronized" functions from visual j++ to c#?

0 Answers  


Error handling and how this is done ?

2 Answers   Digital GlobalSoft,


What is sqladapter c#?

0 Answers  


i want o/p 011242110 in c# code.

0 Answers   TCS,


Give an example of removing an element from the queue?

0 Answers  


Categories