using System;
namespace ConsoleApplication_C_Sharp
{
interface ISize
{
float Height();
float Width();
}
class Program : ISize
{
float height;
float width;
public Program(float height, float width)
{
this.height = height;
this.width = width;
}
// Explicit interface implementation
float ISize.Height()
{
return height;
}
// Explicit interface implementation
float ISize.Width()
{
return width;
}
static void Main(string[] args)
{
Program obj = new Program(3.14f, 5.18f);
ISize myDimensions = (ISize)obj;
Console.WriteLine("Height = {0}", myDimensions.Height());
Console.WriteLine("Width = {0}", myDimensions.Width());
}
}
}
/*
run:
Height = 3.14
Width = 5.18
*/