Interface in C# | Interface in CSharp with Examples
In this video, I am going to discuss one of the most important concepts i.e. Interface in C# with Examples. At the end of this session, I am sure, you will understand what is Interface, why we need an interface, and how to use an interface in C# with Examples.
What is an Interface in C#?
The Interface in C# is a fully un-implemented class used for declaring a set of operations of an object. So, we can define an interface as a pure abstract class which allows us to define only abstract methods. The abstract method means a method without a body or implementation. It is used to achieve multiple inheritances which can’t be achieved by class. It is used to achieve full abstraction because it cannot have a method body.
Till now we are learning classes. So, what is a class? A class is a user-defined data type. Then what is an interface? An interface is also a user-defined data type. Then what is the difference between them? Let us understand this first.
Differences between Class, Abstract Class, and Interface in C#:
A class can contain only the methods which contain the method body. Do we have a method without the body? Yes, we have methods without a body and that is called abstract methods. So, simply we can say class contains a method with a method body or you can say non-abstract methods. Abstract class contains both abstract and non-abstract methods and interface contains only abstract methods.
1. Class: Contains only the Non-Abstract Methods (Methods with Method Body).
2. Abstract Class: Contains both Non-Abstract Methods (Methods with Method Body) and Abstract Methods (Methods without Method Body).
3. Interface: Contain only Abstract Methods (Methods without Method Body).
The text document of this video: https://dotnettutorials.net/lesson/in...
#interface #interfacecsharp #interfacecsharpexamples #csharptutorials #dotnettutorials #csharpinterfaceexamples
Interface in C#
Interface in C# with Examples
Interface in CSharp
Interface in CSharp with Examples
C# Interface
C# Interface Examples
CSharp Interface
CSharp Interface Examples
What is an Interface?
What is an Interface in C#?
On this page of the site you can watch the video online Interface in C# | Interface in CSharp with Examples with a duration of hours minute second in good quality, which was uploaded by the user Dot Net Tutorials 05 September 2022, share the link with friends and acquaintances, this video has already been watched 648 times on youtube and it was liked by 6 viewers. Enjoy your viewing!