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
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 |
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 |
Why interface is required?
What is the use of inheritance in c#?
what is the difference between the debug class and trace class?
Why do we use void in c#?
What is a pre-requisite for connection pooling?
What is a nullreferenceexception and how do I fix it?
Does c# support #define for defining global constants?
What do you mean by serialization in .NET?
is it possible to inherit a class but methods declared in the class should not be inheritable i possible how?
What is the difference between mobile application and desktop application?
What is AutoMapper in C#?
Why do we use reflection in c#?