Hai friends what is the difference between sealed class and private constructor any way both doesnt allow inheritance? If any difference please tell me?
BhuvanRam 0 Newbie Poster
Recommended Answers
Jump to PostSealed classes
A sealed class cannot be used as a base class. For this reason, it also cannot be an abstract class. Sealed classes are primarily used to prevent derivation. They add another level of strictness during compile-time, improve memory usage, and trigger certain optimizations that improve run-time efficiency.
Jump to PostSealed Class:
When applied to a class, the sealed modifier prevents other
classes from inheriting from it. In the following example,
class B inherits from class A, but no class can inherit
from class B.class A {}
sealed class B : A {}You can also use …
All 5 Replies
Zinderin 11 Junior Poster in Training
Alexpap 1 Junior Poster
pritesh2010 30 Posting Whiz in Training
Ketsuekiame 860 Master Poster Featured Poster
BhuvanRam 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.