.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

when can i go for abstract class and when interface

Posted By: sankar     Posted Date: September 07, 2008    Points:2   Category :C#
Hi

could any one plz help to clarify my doubt,


when can i go for abstract class and when interface.

Still now i didn't get clarity on this question.Please give some real world scenarios.


thank to all

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

Use an abstract class when you want to inherit only from the parent

Use an interface when you want to inherit from multiple sources

Use both when you want a basic behavior from the parent and extra features from other sources

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


apart from those which u told,is there any some other critical issues to use interface and abstract classes.

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

Hi Shankar,
Apart from the above one more thing wanted to tell you that interface is faster then Abstract class.

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 is ,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 only declare and you should override it in subclass.

prathap
[URL = "http://wisentechnologies.com/it-courses/.net-training.aspx"].net training in chennai[/URL]



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