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 does namespace mean?

0 Answers  


Why do we use struct in c#?

0 Answers  


what is the purpose of using statement in c#

0 Answers   Cognizant,


What language is arduino?

0 Answers  


What is streamreader/streamwriter class?

0 Answers  






Differentiate between method overriding from method overloading with its functionality?

0 Answers   Siebel,


Is a valid int value?

0 Answers  


what is the scope of anonymous type ?

0 Answers   Wipro,


Which property do we set on a Combo Box to display data on it prior to setting the DataSource ?

0 Answers   Siebel,


What is the boxing and unboxing in c#?

0 Answers  


List the differences between method overriding and method overloading?

0 Answers  


How do you declare a method in c#?

0 Answers  


Categories