Can you prevent your class from being inherited and becoming
a base class for some other classes?

Answers were Sorted based on User's Feedback



Can you prevent your class from being inherited and becoming a base class for some other classes?..

Answer / umesh

Yes, that?s what keyword sealed in the class definition is
for. The developer trying to derive from your class will get
a message: cannot inherit from Sealed class
WhateverBaseClassName. It?s the same concept as final class
in Java.

Is This Answer Correct ?    12 Yes 2 No

Can you prevent your class from being inherited and becoming a base class for some other classes?..

Answer / neerajtyagi

You can prevent your class being derived using sealed
keyword.

But you can't use that class as base class once you make
that sealed.

Sealed and Derived both are opposite.

Is This Answer Correct ?    8 Yes 0 No

Post New Answer

More C Sharp Interview Questions

What are the differences between system.string and system.text.stringbuilder classes?

0 Answers  


What is the difference between interface and abstract class in c#?

0 Answers  


What language is c# similar to?

0 Answers  


Is string a class in c#?

0 Answers  


Can delegates be used as callbacks?

0 Answers  






What is console read in c#?

0 Answers  


What is integer c#?

0 Answers  


What do u mean by thread safe?

0 Answers  


What is the use of functional interface?

0 Answers  


What are the 3 different types of arrays?

0 Answers  


When a switch is said to be congested?

0 Answers   Wipro,


What does xpath return?

0 Answers  


Categories