4
Reply

what diff b\w abstract and interface? when will go for abstract& interface

sainath reddy

sainath reddy

Oct 25, 2010
6.3k
0

    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.

    Harshit Vyas
    November 11, 2010
    0

    Abstract and interface both are similar
    but some difference

    raj gupta
    October 30, 2010
    0

    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.

    prakash gajera
    October 27, 2010
    0

    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.

    prakash gajera
    October 27, 2010
    0