interface and abstract class. [Resolved]

Posted by Santoshkumar under C# on 10/29/2010 | Points: 10 | Views : 1505 | Status : [Member] | Replies : 3
Can anybody gud article to understand difference between interface and abstract class.

thank you.




Responses

Posted by: SheoNarayan on: 10/30/2010 [Administrator] HonoraryPlatinum | Points: 50

Up
0
Down

Resolved
Let me explain you quickly.

Interface is a contract. Interface is used to define the structure of the program. Interface can contain only definition of the classes or properties, it can not have implementation.

Abstract class is generally used as a base class. Where you can place commonly used method or properties. Abstract class can have definition as well as implementation of methods or properties.

For more details, read in below links
http://www.dotnetfunda.com/interview/exam1729-when-to-use-abstract-classes-and-when-interfaces-.aspx
http://www.dotnetfunda.com/articles/article645-abstract-method-and-abstract-class-.aspx
http://www.dotnetfunda.com/forums/thread1679-difference-between-abstract--interface.aspx
http://www.dotnetfunda.com/interview/exam332-when-to-use-interface-over-abstract-class-.aspx

Hope this helps.

Thanks

Regards,
Sheo Narayan
http://www.dotnetfunda.com

Santoshkumar, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: T.saravanan on: 10/30/2010 [Member] [MVP] Silver | Points: 50

Up
0
Down

Resolved
Hi Santhosh,

http://www.pragimtech.com/abstractInterfaces.aspx

Refer this link i hope its useful to you.

Cheers :)

Thanks,
T.Saravanan

Santoshkumar, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Praneethn on: 10/30/2010 [Member] Starter | Points: 25

Up
0
Down
the key differences are:
1. the abstract class contains non abstract class while the interface cannot.
2. a class can implement any number of interfaces but only inherit from one class abstract are not.

Few articles:

http://en.csharp-online.net/Interfaces_and_Abstract_Classes
http://www.dotnetspider.com/forum/160049-Abstract-class-interface-use-with-example.aspx
http://www.codeproject.com/KB/architecture/Abstract_Interface.aspx

Hope this helps you.

Santoshkumar, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response