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

In which format you can pass the value in the sleep function?

0 Answers  


What?s the data provider name to connect to Access database?

6 Answers  


Define a strong name in .net?

0 Answers  


What?s the top .NET class that everything is derived from?

7 Answers  


Explain the three services model (three-tier application). Presentation (ui), business (logic and underlying code) and data (from storage or other sources).

0 Answers  






What is extended class in c#?

0 Answers  


What are data types with examples?

0 Answers  


What does Dispose method do with the connection object?

3 Answers  


What is difference between dictionary and hashtable in c#?

0 Answers  


if we inherit class in stack so object of stack will store in stack or heap? as class a { int s; public aa(){} } stack mystack:a { } mystack obj; ans: about obj

1 Answers  


What are data types examples?

0 Answers  


Difference between dispose and destructor?

3 Answers   TCS,


Categories