Jasbeer Singh
What is the difference between sealed class and abstract class?
By Jasbeer Singh in C# on Dec 21 2016
  • Ayappan Alagesan
    Feb, 2017 10

    1)Sealed class cannot be inherited by a normal class. 1)Abstract class must be inherited by a class.2)Instance must be used for Sealed class for accessing its public methods. 2)Instance cannot be created for Abstract class and it should be inherited for accessing its abstract methods.3)Sealed class methods cannot be override. 3)Abstract class methods can be override.

    • 7
  • Subhashkumar Yadav
    Feb, 2017 22

    Sealed Class --->A sealed class is a class that cannot be inherited. Sealed classes are used to restrict the inheritance feature of object oriented programming. -------------------------------------------------------------------------------------------- Interface --> An interface is like a class but all the methods and properties are abstract. An Interface cannot be instantiated like abstract class. All the methods and properties defined in Interface are by default public and abstract.Interface generally refers to an abstraction that an entity provides of itself to the outside. Interface can help in separating the methods for external and internal communication without effecting in the way external entities interact with the type..

    • 3
  • Naveen Bisht
    Feb, 2017 16

    Sealed mean their are something you don't want to share, while creating abstract class means you want explore things, so that child class can apply same contract type.

    • 1
  • Bharathi Raja
    Jan, 2018 20

    abstract class Should be used when there is a IS-A relationship and no instances should be allowed to be created from that abstract class. Example: An Animal is an abstract base class where specific animals can be derived from, i.e. Horse, Pig etc. By making Animal abstract it is not allowed to create an Animal instance.sealed class By making Horse sealed, it is not possible to inherit from it, e.g. making classes like Pony or WorkHorse which you like to be inheriting from Horse.

    • 0
  • Mukesh Kumar
    Aug, 2017 28

    If u mark a class as Sealed Then you can not inherit it If u mark a class as Abstract then you have to inherit it

    • 0
  • Alok Tripathi
    Mar, 2017 29

    The abstract class enables you to create class and class members that are incomplete and must be implemented in a derived class but if you talking about sealed class it not allow the Inheritance. Sealed class never used as parent class

    • 0
  • sushil kumar
    Feb, 2017 9

    1. we can create object of sealed class but cannot for abstract class. 2. sealed class cannot be inheritable but a abstract class implements its method in derived class.

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS