//程序代码w5-8
public class CoOrds
{
    private int x, y;
    public CoOrds()  				//构造函数
    {
        x = 0;
        y = 0;
    }
    public int X
    {
        get { return x; }
        set { x = value; }
    }
    public int Y
    {
        get { return y; }
        set { y = value; }
}
public new void Invert()
{
    int temp = X;
    X = Y;
    Y = temp;
    screenColor = System.Drawing.Color.Gray;
}

}
//按如下方式从 CoOrds 类派生一个名为 ColorCoOrds 的新类：
public class ColorCoOrds : CoOrds
{
    private System.Drawing.Color screenColor;
    public ColorCoOrds()				//构造函数
    {
        screenColor = System.Drawing.Color.Red;
    }
    public System.Drawing.Color ScreenColor
    {
        get { return screenColor; }
        set { screenColor = value; }
    }
}
