An Interface in C#

Ganeshji
Posted by in C# category on for Beginner level | Points: 250 | Views : 8364 red flag

This article covers the detailed feature an interface.


 Download source code for An Interface in C#


Introduction


Interface contains the method declarations. It can be implemented by more than one class. Multiple interfaces can be implemented by a single class.


Method of a sub class overrides the method of an interface





Output






If the method of an interface is not overridden, then the following error comes.




Error Message






Multiple interfaces can be implemented by a single class






Output





Multiple Class can implement  the same interface and can use it, according to their requirement






Output






Interface cannot contain the definition of a method.






Error Message








Conclusion

Interface can be used in C# for multiple inheritance. This particular point will b covered in my next article.

Happy Coding!

Page copy protected against web site content infringement by Copyscape

About the Author

Ganeshji
Full Name: Zinnia Sarkar
Member Level:
Member Status: Member
Member Since: 7/24/2010 12:50:40 PM
Country: India
Regards, Ganeshji


Login to vote for this post.

Comments or Responses

Posted by: Karthikanbarasan on: 2/17/2011 | Points: 25
Nice article... please upload the code as well/....
Posted by: Ganeshji on: 2/17/2011 | Points: 25
Thnx Karthikanbarasan. I shall upload the code also.
Posted by: Karthikanbarasan on: 2/17/2011 | Points: 25
Thanks... Please post on the Partial class, Partial Methods as well!!!
Posted by: Madhu.b.rokkam on: 2/17/2011 | Points: 25
Nice one ..
Posted by: Tripati_tutu on: 2/19/2011 | Points: 25
Nice article...
Posted by: Akiii on: 8/15/2011 | Points: 25
Interfaces are basically used to give us a coding structure and helps us to maintain code.

Nice descriptive article..

Thanks and Regards
Akiii
Posted by: Ganeshji on: 8/17/2011 | Points: 25
Thnx Akii !

Login to post response

Comment using Facebook(Author doesn't get notification)