Interface and Abstract class

  • Posted on : June 9, 2008
  • Modified: November 5, 2020

  • Author : SPEC INDIA
  • Category : General

 

  • A class may inherit several interfaces but only one abstract class.

  • An interface cannot provide any code, just the signature. An abstract class can provide complete, default code and/or the details that have to be overridden.

  • An interface cannot have access modifiers for the attributes and operations (all are public). An abstract class can contain access modifiers for the attributes and operations

  • No fields can be defined in interfaces. An abstract class can have fields and constrants defined

  • If various implementations only share method signatures then it is better to use Interfaces. If various implementations are of the same kind and use common behaviour or status then abstract class is better.

  • If various implementations only share method signatures then it is better to use Interfaces.  If various implementations are of the same kind and use common behaviour or status then abstract class is better to use.

 

 

Author: SPEC INDIA


less words, more information

Tech
IN 200
words

Read our microblogs

Subscribe Now For Fresh Content

Loading

Guest Contribution

We are looking for industry experts to contribute to our blog section through fresh and innovative content.

Write For Us

Our Portfolio

Proven Solutions Across Industries
Technology for Real-Life

Visit Our Portfolio

Scroll Up