Can you allow class to be inherited, but prevent the method
from being over-ridden?

Answers were Sorted based on User's Feedback



Can you allow class to be inherited, but prevent the method from being over-ridden?..

Answer / umesh

Yes, just leave the class public and make the method sealed.

Is This Answer Correct ?    17 Yes 1 No

Can you allow class to be inherited, but prevent the method from being over-ridden?..

Answer / anubhav gupta

We can use shadowing concept.
For shadowing use New keyword in derived class method.
Through this we can prevent the method from being over
ridden.

Is This Answer Correct ?    6 Yes 3 No

Post New Answer

More C Sharp Interview Questions

What is ildasm.exe used for?

0 Answers  


What is cookies in c# asp net?

0 Answers  


Whats the use of string builder?

1 Answers   ADITI,


What is the syntax for calling an overloaded constructor within a constructor (this() and constructorname() does not compile)?

0 Answers  


Can properties be private in c#?

0 Answers  






How does bitwise xor work?

0 Answers  


What are methods in C#?

0 Answers   Winsol Solutions,


How do I trim a space in c#?

0 Answers  


What are instance fields in c#?

0 Answers  


What is verbatim string?

0 Answers  


Define multicast delegate? How it be used?

0 Answers   Siebel,


In .Net, what is an assembly? Also explain the type of assembly.

0 Answers   Accenture,


Categories