-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathInterfaceExpression.cs
More file actions
34 lines (31 loc) · 922 Bytes
/
InterfaceExpression.cs
File metadata and controls
34 lines (31 loc) · 922 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
* Interface is not a class, it is a structure that defines the contract in the form of methods, properties, events, or indexers.
* It is defined by using the interface keyword.
* By convention, interface names are prefixed with the letter I, such as IShape, IData, etc.
* It is just a declaration and does not provide any implementation.
* A class or struct can implement one or more interfaces.
* Interfaces are used to implement multiple inheritance in C#.
*/
using System;
namespace Basics
{
class InterfaceExpression
{
private interface IShape
{
void Draw();
}
private class Circle : IShape
{
public void Draw()
{
Console.WriteLine("Drawing Circle");
}
}
public void Display()
{
Circle circle = new Circle();
circle.Draw();
}
}
}