Monday, 28 March 2011

Filled Under:

Difference between Abstract classes and Interface

  • Abstract Class
    • A class may inherit only one abstract class.
    • An abstract class can contain access modifiers for the subs, functions, properties.
    • An Abstract class has abstract or concrete subs, functions, properties etc.
    • An abstract class can have fields and constants defined.
 
    • Interface
      • A class may inherit several interfaces, which help achieving Multiple Inheritance.
      • An interface cannot have access modifiers for the subs, functions, properties etc everything is assumed as public
      • An interface can only have abstract subs, functions, properties etc
      • No fields can be defined in interface
    Ref- here, here

    0 comments:

    Post a Comment