sainath reddy
what diff b\w abstract and interface? when will go for abstract& interface
By sainath reddy in ASP.NET on Oct 25 2010
  • Harshit Vyas
    Nov, 2010 11

    Abstract Class:

    1. Abstract Class Can contain Abstract Methods and Non-
    Abstract Methods.

    2. When a Non-Abstract Class is Inherited from an Abstract
    Class, the Non-Abstract Class should provide all the
    implementations for the inherited Abstract Method.

    Interface:

    1. Interface is nothing but Pure Abstract Class ie
    Interface can contain only the function declaration.

    2. All the members of the interface are Public by Default
    and you cannot provide any access modifiers.

    3. When a class is inherited from the interface, the
    inherited class should provide actual implementations for
    the inherited members.

    • 0
  • raj gupta
    Oct, 2010 30

    Abstract and interface both are similar
    but some difference

    • 0
  • prakash gajera
    Oct, 2010 27

    When there is a need to inheritance then abstract class should be used.
    And When there is need to common functionality implementation by more then one class then Interfaces should be used.

    • 0
  • prakash gajera
    Oct, 2010 27

    Abstract class contains pure virtual function and must/can be inherited by the derived class to implement inheritance.
    Where as Interface contains only definition of the functions and must/can be implemented by any other class.

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS