using System;
interface ICube
{
// Property signatures:
int x
{
get;
set;
}
}
class Cube : ICube
{
// Fields:
private int _x;
// Constructor:
public Cube(int x)
{
_x = x * x * x;
}
// Property implementation:
public int x
{
get
{
return _x;
}
set
{
_x = value;
}
}
}
class MainClass //or Program
{
static void PrintCube(ICube p)
{
Console.WriteLine("x={0}", p.x);
}
static void Main()
{
int a = 100;
Cube p = new Cube(a);
Console.Write("My Cube: ");
PrintCube(p);
}
}
dXNpbmcgU3lzdGVtOwoKaW50ZXJmYWNlIElDdWJlCnsKICAgLy8gUHJvcGVydHkgc2lnbmF0dXJlczoKICAgaW50IHgKICAgewogICAgICBnZXQ7CiAgICAgIHNldDsKICAgfQogICAKfQogCmNsYXNzIEN1YmUgOiBJQ3ViZQp7CiAgIC8vIEZpZWxkczoKICAgcHJpdmF0ZSBpbnQgX3g7CiAKICAgLy8gQ29uc3RydWN0b3I6CiAgIHB1YmxpYyBDdWJlKGludCB4KQogICB7CiAgICAgIF94ID0geCAqIHggKiB4OwogICB9CiAKICAgLy8gUHJvcGVydHkgaW1wbGVtZW50YXRpb246CiAgIHB1YmxpYyBpbnQgeAogICB7CiAgICAgIGdldAogICAgICB7CiAgICAgICAgIHJldHVybiBfeDsKICAgICAgfQogCiAgICAgIHNldAogICAgICB7CiAgICAgICAgIF94ID0gdmFsdWU7CiAgICAgIH0KICAgfQogCn0KIApjbGFzcyBNYWluQ2xhc3MgLy9vciBQcm9ncmFtCnsKICAgc3RhdGljIHZvaWQgUHJpbnRDdWJlKElDdWJlIHApCiAgIHsKICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIng9ezB9IiwgcC54KTsKICAgfQogCiAgIHN0YXRpYyB2b2lkIE1haW4oKQogICB7CiAgICAgIGludCBhID0gMTAwOwogICAgICAKICAgICAgQ3ViZSBwID0gbmV3IEN1YmUoYSk7CiAgICAgIENvbnNvbGUuV3JpdGUoIk15IEN1YmU6ICIpOwogICAgICBQcmludEN1YmUocCk7CiAgIH0KfQ==