Hi Guest

MobileUser

1 HomePage 1 Jobs 1 WalkIn 1Articles  

Cat Exam

 :) Latest Topic
AJAX
VB.NET
SQL Query
UDDI
CLASS
JavaScript Questions
SharePoint Interview
SilverLight
WCF
general knowledge
 ASP.NET
 :) Hot Jobs
 
 :) Latest Articles


  

 


difference in between abstrct classes and interfaces
Question Posted on 24 Nov 2011

Home >> 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



 
 Input Your Comments Or suggestions(If Any)
 Name
 Email(optional)
 Comments


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






 
Top Searches:asp net questions vb net questions sql query uddl questions class javascript Questions sharepoint interview questions and concept silverlight questions and concept wcf questions beans general knowledge ajax questions
PHP | Biztalk | Testing | SAP | HR |