MindFusion's Components
Home | Submit an interview question | Filter by category | Filter by job function | Filter by company
 
Member Information
User Id
Password
 
Forgot Password
Technology Category
.NET (1202)
Languages (103)
Database (146)
Operating System (48)
Reporting (5)
Third-Party Tools (2)
Testing (91)
OOP (75)
Web Development (40)
Design Patterns (89)
General (9)
Networking (88)
Hardware (63)
Brain Exercise (2)
Others (37)
 Our Network
.NET Heaven
C# Corner
Interview Corner
Longhorn Corner
Mindcracker
VB.NET Heaven
Home » .NET » .NET
What’s the difference between an interface and abstract class?
Posted by nikhil kansal Jul 14, 2006
Viewed : 62920 times
Major Category : .NET
Minor Category : ASP.NET
Total Replies : 27
Become a Sponsor
 EDITORIAL ANSWER  
No Reply Yet
 ANSWERS BY USERS  
Prasoon
Jun 12, 2009
See if this Article Helps which in details covers difference bot programatically and theoratically.

http://www.c-sharpcorner.com/UploadFile/prasoonk/AbstractClassvsInterface06102009051117AM/AbstractClassvsInterface.aspx
satya kishore
Mar 24, 2009

for .net interview question and answers

pls visit my blog

satyakishore.webs.com

pula narasima
Jan 02, 2009

Hi,

Abstract class is the Act sa the base class,It supports implmented methods and unimplimented methods,Abstract calss as followes on derived class.
in Abstract class you can Declare the Constructors,fields,methods,indexes,destructors etc
Example:
pulic Abstract Class A
{
public void Hi();

public void Hello()
{
Console.WriteLine("hello method");
}

}
public Class B
{
public overid void Hi()
{
Console.WriteLine("hi method");
}
}
Interface: Interface is the Collection of Abstrcted method is called interface,By default is the Public
in interface  you can not  Declare the Constructors,fields,methods,indexes,destructors .
Examples:'
//mutltiple inhiritance
Interface IA
{
void cat();
void Dog();
}
Interface IB
{
void door();
void tyres();
}
public class C:IA,IB
{
public void cat()
{
Console.WriteLine("hello cat method");
}
public void dog()
{
Console.WriteLine("hello dog method");
}
public void door()
{
Console.WriteLine("hello door method");
}
public void tyres()
{
Console.WriteLine("hello tyres method");
}
}

 

Thaker Kandarp
Nov 08, 2008

Interface are similar to abstraction classes.However , interfaces represent the higest level of abstraction in Object- oriented programming.This is because all the methods in an interface are abstract and do not have implementation.In contrast ,the abstract classes might contain a method that has a body.

nitesh kumar
Aug 01, 2008
1).Interface have only signature. whereas Abstract class have signature and definition both r allow. 2). Interface have not allow modifier access. whereas Abstract class are allowed modifier access. 3).Thurogh the Interface we can create the Multiple Inheritance whereas Abstract class are not allow the Multiple Inheritance. 4).Interface is slower compare Abstract class.
nagaraju rekulapelli
Jul 13, 2008
Interface:- 1. Interfaces are used to declaring functionality. 2. By default all interface methods are public. 3. In class you can implement the interface method, but can’t implement the body in Interface method. Abstract:- 1. Abstract will allow you to set the access specifier. Ex:- (private,public, protected, internal). 2. Abstract will allow you to implement the body in abstract methods. 3. You can inherit the abstract methods in classes.
wang heaven
Jul 02, 2008
in an interface class, all the methods are abstract, these is no implementation,and no accessbility modifiers are allowed, in an abstract class, some of the methods can be concrete,an abstract class may have some accessbility modifiers.
sanjeev singh
Jun 09, 2008
An abstract class may contain complete or incomplete methods. Interfaces can contain only the signature of a method but no body. Thus an abstract class can implement methods but an interface can not implement methods. · An abstract class can contain fields, constructors, or destructors and implement properties. An interface can not contain fields, constructors, or destructors and it has only the property's signature but no implementation. · An abstract class cannot support multiple inheritance, but an interface can support multiple inheritance. Thus a class may inherit several interfaces but only one abstract class. · A class implementing an interface has to implement all the methods of the interface, but the same is not required in the case of an abstract Class. · Various access modifiers such as abstract, protected, internal, public, virtual, etc. are useful in abstract Classes but not in interfaces.
sanjeev singh
Jun 09, 2008
An abstract class may contain complete or incomplete methods. Interfaces can contain only the signature of a method but no body. Thus an abstract class can implement methods but an interface can not implement methods. · An abstract class can contain fields, constructors, or destructors and implement properties. An interface can not contain fields, constructors, or destructors and it has only the property's signature but no implementation. · An abstract class cannot support multiple inheritance, but an interface can support multiple inheritance. Thus a class may inherit several interfaces but only one abstract class. · A class implementing an interface has to implement all the methods of the interface, but the same is not required in the case of an abstract Class. · Various access modifiers such as abstract, protected, internal, public, virtual, etc. are useful in abstract Classes but not in interfaces.
Sphurthy
May 05, 2008
Check out Interview Questions and Answers for a perfect answer to this question.
  
1 2 3

 

 Hosted by MaximumASP  |  Found a broken link?  |  Contact Us  |  Terms & conditions  |  Privacy Policy  |  Advertise with us
Current Version: 2.2009.3.2
 © 1999 - 2009  Mindcracker LLC. All Rights Reserved