using System.IO;
using System;
public class Shape
{
public string GetName(){return "shape";}
}
public class Ball : Shape
{
public new string GetName(){return "ball";}
}
public class Pet
{
public virtual string GetName(){return "pet";}
}
public class Cat : Pet
{
public override string GetName(){return "cat";}
}
class Program
{
static void Main(string[] args)
{
Pet myPet = new Cat();
Cat johnsCat = new Cat();
Shape shape = new Ball();
Console.WriteLine(string.Format("My {0} is playing with a {1}. John's {2} is sleeping", myPet.GetName(), shape.GetName(), johnsCat.GetName()));
}
}
dXNpbmcgU3lzdGVtLklPOwp1c2luZyBTeXN0ZW07CgpwdWJsaWMgY2xhc3MgU2hhcGUKewogICAgcHVibGljIHN0cmluZyBHZXROYW1lKCl7cmV0dXJuICJzaGFwZSI7fQp9CgpwdWJsaWMgY2xhc3MgQmFsbCA6IFNoYXBlCnsKICAgIHB1YmxpYyBuZXcgc3RyaW5nIEdldE5hbWUoKXtyZXR1cm4gImJhbGwiO30KfQoKcHVibGljIGNsYXNzIFBldAp7CiAgICBwdWJsaWMgdmlydHVhbCBzdHJpbmcgR2V0TmFtZSgpe3JldHVybiAicGV0Ijt9Cn0KCnB1YmxpYyBjbGFzcyBDYXQgOiBQZXQKewogICAgcHVibGljIG92ZXJyaWRlIHN0cmluZyBHZXROYW1lKCl7cmV0dXJuICJjYXQiO30KfQoKY2xhc3MgUHJvZ3JhbQp7CiAgICBzdGF0aWMgdm9pZCBNYWluKHN0cmluZ1tdIGFyZ3MpCiAgICB7CiAgICAgICAgUGV0IG15UGV0ID0gbmV3IENhdCgpOwogICAgICAgIENhdCBqb2huc0NhdCA9IG5ldyBDYXQoKTsKICAgICAgICBTaGFwZSBzaGFwZSA9IG5ldyBCYWxsKCk7CiAgICAgICAgCiAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoc3RyaW5nLkZvcm1hdCgiTXkgezB9IGlzIHBsYXlpbmcgd2l0aCBhIHsxfS4gSm9obidzIHsyfSBpcyBzbGVlcGluZyIsIG15UGV0LkdldE5hbWUoKSwgc2hhcGUuR2V0TmFtZSgpLCBqb2huc0NhdC5HZXROYW1lKCkpKTsKICAgIH0KfQ==