Abstract Class | Interface | |
Multiple inheritance | Doesn’t support | support |
Data Member | contains | Doesn’t contain |
Constructor declaration | contains | Doesn’t contain |
Definition | May contain definition with no implementation | Just a pattern, an empty shell |
Methods | Can have both abstract & non-abstract methods | Can only have abstract methods |
Implementation | Can contain both definition and its implementation
Incomplete class, cannot be instantiated |
Can only have the signature of the functionality without any code |
Access Modifier | Can have all access modifiers for member declaration of functions, subs and properties. | Not allowed (all methods must be implicitly defined as public).
All the members assumed as implicitly public. |
Homogeneity | is used for implementations of the same type, behavior and status | Is used for implementations that share only method signatures |
Declaration | Acts as a base class for all other classes, can declare/ use any variable | Not allowed to declare any variables |
Core vs Peripheral | Core identity of a class & for objects of the same data type | Used to define Peripheral ability of a class |
Rigid vs Supple | More supple | More rigid |
Fields definition | Predefined fields & constants | Fields cannot be defined in interfaces |