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 is querystring in c#?

0 Answers  


Why static constructor is parameterless in c#?

0 Answers  


What is icollection in c#?

0 Answers  


Can we inherit class that contains only one private constructor?

0 Answers  


Is cli same as the clr?

0 Answers  






What does the keyword virtual mean in the method definition?

1 Answers  


What is the use of ienumerable?

0 Answers  


Explain more on CLR

0 Answers  


How big is a float?

0 Answers  


What does the This window show in the debugger?

2 Answers  


What is the keyword used to prevent a class from being inherited by another class?

0 Answers   Siebel,


what does static void Main(string[] args) in C# mean????????

5 Answers   ssinformatics,


Categories