2
Answers

Interface

Maha

Maha

11y
1k
1
http://www.dotnetperls.com/interface

Following program is given in the above website (1st program)

Instance is IPerl perl = new Test(); it is also giving same output with Test perl = new Test();. How can these differences be explained? Problem is highlighted.

using System;

interface IPerl
{
void Read();
}

class Test : IPerl
{
public void Read()
{
Console.WriteLine("Read");
}
}

class Program
{
static void Main()
{
IPerl perl = new Test(); // Create instance.
perl.Read(); // Call method on interface.

Console.ReadKey();
}
}

Answers (2)