.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal

Home >> Interview Question >> C# >> Post New Question Subscribe to Interview Questions

What is the difference between Abstract and Interface.

Posted By :Ashutosh Jha     Posted Date :August 31, 2014    Points :40   Category :C# 
Interface is not a class. An interface can only contain the method definition without the body.

On the other-hand, an abstract class is a class that contains the method definition and may or may not contain the method body.
It acts as a base class can be inherited from other child class.

One class can inherit only one abstract class at a given time where is it can implement one or more interface.

You can also find related Interview Question to What is the difference between Abstract and Interface.  below: 

What is the difference between interface and abstract class ?

a class may inherit several interfaces, a class may inherit only one abstract class (More...)

What is difference between abstract class and an interface?

An Abstract class is a class with some common/certain implementations and defines abstraction for other services which are implemented in its concrete sub classes, whereas interface only have method declaration with zero implementations. An abstract class and Interface both have method only but not have body of method. The difference between Abstract class and An Interface is that if u call Abstract class then u have to call all method of that particular Abstract class but if u call an Interface then it is not necessary that u call all method of that particular interface. An abstract class is a special kind of class that cannot be instantiated. So the question is why we need a class that cannot be instantiated? An abstract class is only to be sub-classed (inherited from). In other words, it only allows other classes to inherit from it but cannot be instantiated. The advantage is that it enforces certain hierarchies for all the subclasses. In simple words, it is a kind of contract that forces all the subclasses to carry on the same hierarchies or standards.

An interface is not a class. It is an entity that is defined by the word Interface. An interface has no implementation; it only has the signature or in other words, just the definition of the methods without the body. As one of the similarities to Abstract class, it is a contract that is used to define hierarchies for all subclasses or it defines specific set of methods and their arguments. The main difference between them is that a class can implement more than one interface but can only inherit from one abstract class. Since C# doesn't support multiple inheritance, interfaces are used to implement multiple inheritance.

Shashi Ray (More...)

What's the difference between an interface and abstract class?

In an interface class, all methods must be abstract. In an abstract class some methods can be concrete. In an interface class, no accessibility modifiers are allowed, which is ok in an abstract class. (More...)

What's the difference between an interface and abstract class?

Abstract Class:

A class that cannot be instantiated. An abstract class is a class that must be inherited and have the methods overridden. An abstract class is essentially a blueprint for a class without any implementation.


Interfaces like classes define a set of properties methods and events. But unlike classes interfaces do not provide implementation. They are implemented by classes and defined as separate entities from classes (More...)

Difference between Interface and abstract class

When we need the subclasses to must implement all the methods of base class the then we Interface.
Abstract class can also contain no-abstract methods (More...)

What's the difference between an interface and abstract class?

(1)In the interface all methods must be abstract.
(2)In the abstract class some methods can be concrete. (More...)

What is difference between interface inheritance and class inheritance?

We can only inherit from one class but multiple interfaces. In addition, an interface does not contain any implementation it just contains a series of signatures. (More...)

what is the difference between a class and a interface?

You can instantiate a class but you cannot instantiate an interface,you can only offer the funtionality of that interface not the implementation. (More...)

Expalin one difference between Abstract and virtual methods?

Virtual method can be overriden in any of its derived class and abstract method must be overriden in any of the non abstract class. (More...)

What is the difference between abstract class and interfaces?

1) Concrete methods are applicable to abstract class only, interface cannot use them.

2)Abstract class uses inheritance while interface does not use inheritance. (More...)

What is an interface and what is an abstract class?

In an interface class, all methods are abstract without implementation whereas in an abstract class, some methods we can define concrete.

In interface, no accessibility modifiers are allowed. An abstract class may have accessibility modifiers. Interface and abstract class are basically a set of rules which you have to follow in case you are using/inheriting them. (More...)

Difference Between Delete and Truncate

.Delete table is a logged operation, so the deletion of each row gets logged in the transaction log, which makes it slow.

. Truncate table also deletes all the rows in a table, but it won't log the deletion of each row, instead it logs the de-allocation of the data pages of the table, which makes it faster. Of course, truncate table cannot be rolled back.

. Truncate table is functionally identical to delete statement with no "where clause" both remove all rows in the table. But truncate table is faster and uses fewer system and transaction log resources than delete.

. Truncate table removes all rows from a table, but the table structure and its columns, constraints, indexes etc., remains as it is.

. In truncate table the counter used by an identity column for new rows is reset to the seed for the column.

. If you want to retain the identity counter, use delete statement instead.

. If you want to remove table definition and its data, use the drop table statement.

. You cannot use truncate table on a table referenced by a foreign key constraint; instead, use delete statement without a where clause. Because truncate table is not logged, it cannot activate a trigger.

. Truncate table may not be used on tables participating in an indexed view. (More...)

Difference between assembly manifest & metadata?

assembly manifest - An integral part of every assembly that renders the assembly self-describing. The assembly manifest contains the assembly's metadata. The manifest establishes the assembly identity, specifies the files that make up the assembly implementation, specifies the types and resources that make up the assembly, itemizes the compile-time dependencies on other assemblies, and specifies the set of permissions required for the assembly to run properly. This information is used at run time to resolve references, enforce version binding policy, and validate the integrity of loaded assemblies. The self-describing nature of assemblies also helps makes zero-impact install and XCOPY deployment feasible.

metadata - Information that describes every element managed by the common language runtime: an assembly, loadable file, type, method, and so on. This can include information required for debugging and garbage collection, as well as security attributes, marshaling data, extended class and member definitions, version binding, and other information required by the runtime. (More...)

What is the difference between ref & out parameters?

An argument passed to a ref parameter must first be initialized. Compare this to an out parameter, whose argument does not have to be explicitly initialized before being passed to an out parameter. (More...)

Quick Links For Interview Questions Categories:
ASP.Net Windows Application   .NET Framework   C#   VB.Net   ADO.Net  
Sql Server   SharePoint   Silverlight   OOPs   JQuery   JavaScript/VBScript
Biztalk Patten/Practices .IIS WCF WPF WWF
Networking Aptitude Others   All      

Find questions, FAQ's and their answers related to .NET, C#, Vb.Net, Sql Server and many more.

Now you can find lots of .NET, C#, Vb.Net, SQL Server,Windows, ASP.Net related Questions and their Answers here at www.dotnetspark.com. Our aim is to help you pass your certification Exams (MCP, MCSD, MCAD etc.,) with flying scores and get good name in your company.

So, Start looking our Interview Question section daily and improve your .NET Skills. You can also help others by posting Interview Questions and their Answers in this section.

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend