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


Top 5 Contributors of the Month
david stephan

Home >> Forum >> C# >> Post New QuestionBookmark and Share Subscribe to Forum

what really differs an abstract class from interface and vice versa

Posted By: sankar     Posted Date: September 06, 2008    Points:2   Category :C#
what really differs an abstract class from interface and vice versa

Responses
Author: Amit Mehra             
Posted Date: September 07, 2008     Points: 5   

Hi
You should use interface when:

a)There are a group of related methods that may be called.

b)A class only needs one implementation of the method.

c)The class using the interface will want to cast that interface to other interface or class types.

d)The method being implemented is linked to the type or identity of the class: for example, comparison methods.

Thanks,
Amit
Please "Mark As Answer " if this post help you.
Author: sankar             
Posted Date: September 07, 2008     Points: 5   

hi Amit thank you very much


could you please elaborate your answer

actually i didn't get exact solution

sorry to say

Author: Amit Mehra             
Posted Date: September 07, 2008     Points: 5   

Hi,
If you are looking for difference

1) The abstract class allows concrete methods (methods that have implementation) but interface doesn't not.

2) A class can inherit from only one class, but can implement any number of interfaces.

3) Interface doesn't allow variables/constants to be declared but abstract class allows for declaration of variables and constants.

Thanks,
Amit
Please "Mark As Answer " if this post help you.
Author: prathap             
Posted Date: September 10, 2013     Points: 20   

By using abstract class and interface we can implement the inheritance concept.The difference are in abstract class you can define the method and in subclass you should override.But incase of interface you can't define the method you can declare and you should override it in subclass.


prathap
http://wisentechnologies.com/it-courses/.net-training.aspx

Author: prathap             
Posted Date: September 10, 2013     Points: 20   

By using abstract class and interface we can implement the inheritance concept.The difference are in abstract class you can define the method and in subclass you should override.But incase of interface you can't define the method you can declare and you should override it in subclass.


prathap
http://wisentechnologies.com/it-courses/.net-training.aspx



Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

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