crackyourinterview.com


To improves our performance please Like Share Subscribe(Will boost us)

difference in between abstrct classes and interfaces
Question Posted on 24 Nov 2011Home >> OOPS >> oops questions >> difference in between abstrct classes and interfaces

(1)Multiple inheritance
Interface is not a class but a class may inherit several interfaces.
A class may inherit only one abstract class.
(2)Default implementation
Interface not provide any code that is default
abstract class provide default code and/or just the details that have to be overridden.
(3)Fast
Interface eequires more time to find the actual method in the corresponding classes.
It is very fast in abstract class
(4)Access Modfiers
Interface doesnot have access modifiers for its subs, functions, properties etc everything is assumed as public
Abstract class can contain access modifiers for the subs, functions, properties
(5)Declartion of Fields
Interface cannot defined and fields
Abstract class can have fields and constrants declartion
(6)Peripheral
Interfaces are used to define the peripheral abilities of a class. In other words both Human and Vehicle can inherit from a IMovable interface.
An abstract class defines the core identity of a class and there it is used for objects of the same type.
(7)Homogeneity
Interface is suitable where various implementations only share method signatures
If various implementations are of the same kind and use common behaviour or status then abstract class is better to use.
(8)New Method
If we add a new method to an Interface then we have to track down all the implementations of the interface and define implementation for the new method.
If we add a new method to an abstract class then we have the option of providing default implementation and therefore all the existing code might work properly.
0
0




.


Most Visited Questions:-

Deep Learning Questions Answers
Below are the different Deep Leaning Questions and answer a More...

What is Gulpjs and some multiple choice questions on Gulp
Gulpjs is an open source whihc helps in building Javascript More...

Continuous Integration Questions Answers
Below are the 20 odd questions for CI or Continuous Integra More...

Derived relationships in Association Rule Mining are represented in the form of __________.
Derived relationships in Association Rule Mining are repres More...

Microservices Architecture Questions Answers
Below are the different questions on Microservices Architec More...




Other Important Questions

Datatype of pointer and how to handle it in 32,64 bit computer

How a pointer stores values of an object

difference in between abstrct classes and interfaces






@2014-2022 Crackyourinterview (All rights reserved)
Privacy Policy - Disclaimer - Sitemap