Rajanikant Hawaldar
What is the criteria to create abstract class and interface?

What is the criteria to create abstract class and interface?

By Rajanikant Hawaldar in C# on Jul 14 2021
  • Rajeev Kumar
    Mar, 2023 17

    An abstract class must have at least one abstract method. An abstract class includes final methods. An abstract class may also include non-abstract methods. An abstract class can consist of constructors and static methods.In INTERFACE If you are creating functionality that will be useful across a wide range of objects, then you must use an interface. Abstract classes, at the end of the day, should be used for objects that are closely related. But the interfaces are best suited for providing common functionality to unrelated cases

    • 0
  • Prasad Kulkarni
    Sep, 2021 4

    Abstact class gives you functioality that can be implemnted or override in sub classes, whereras interface allows you to define not implement the functionality, so ween ever you want to extend the functionality of base class you can use abstract class, as it only allow inheritance.

    • 0
  • Sudhakar Vedam
    Jul, 2021 21

    Abstract class: It can be half way implemented Interface: It is pure abstraction form i.e. it forces the class which implements interface to implement all the members of the interface. Whenever if you have a situation like some default functionality should exists and possibility of override that functionality. In this case we can use Abstract classes are useful. Wherever need of force to implement behavior, we can use interface.

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS