Interface Implementation in C#

Now we are going to learn about the interface implementation in C# .
  • 3342

Introduction

We are known that interfaces may be implemented by classes and structs. There is a slightly logical difference between classes and structs class which is ref. type and structs is a value type. Both of the class and structs implements an interface. The base class list of the class and structs included in the interface identifier.

Example

class Program
{       
static
void Main(string[] args)
{
ABC
c = new PQR();
}
}
interface
ABC
{
void
print();
}
interface
XYZ : ABC
{
void
Read();
}
class
PQR : XYZ
{
public
void Read() { }
public
void Print() { }
}
}

© 2020 DotNetHeaven. All rights reserved.