class Dummy
{
public void D()
{
MessageBox.Show("Dummy.D() ");
}
}
class Puppet
{
public void P()
{
MessageBox.Show("Puppet.P() ");
}
}
class Test
{
public void F(object obj)
{
if (obj is Dummy)
{
Dummy d = (Dummy)obj;
d.D();
}
else if (obj is Puppet)
{
Puppet p = (Puppet)obj;
p.P();
}
}
private static void G()
{
F(new Dummy());
F(new Puppet());
}
}