Hi guys , Is their is any comparision between sealed class and abstract class. When to use sealed and abstract class.

Recommended Answers

All 3 Replies

A sealed class cannot be derived from, you can't inherit from it.
An abstract class must be derived from, you have to inherit from it and create the missing methods.

The abstract keyword enables you to create classes and class members that are incomplete and must be implemented in a derived class.

The sealed keyword enables you to prevent the inheritance of a class or certain class members that were previously marked virtual.

if we can create a object of sealed class then it has not need to create a derived class .
but abstract class has no any object so we must create
derived class

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.