using System;
using System.Text;

class SimpleVector
{
    public int X;
    public int Y;

    public SimpleVector(int x, int y)
    {
        this.X = x;
        this.Y = y;
    }

    public override string ToString()
    {
        return String.Format("( " + X + " ; " + Y + " )");
    }

    public override bool Equals(Object obj)
    {
        if (obj == this)                        // Schnelltest für Reflexivität
            return true;

        if (obj == null)                        // Schnelltest auf null
            return false;

        SimpleVector sv = obj as SimpleVector;  //Typ gleich?
        if ((System.Object)sv == null)
            return false;

        if (this.X == sv.X && this.Y == sv.Y)   // Inhalt gleich
            return true;
        else
            return false;
    }

    public override int GetHashCode()
    {
        int hash = 1;
        const int prime = 17;

        hash = hash * prime + X;
        hash += hash * prime + Y;

        return hash;
    }
}


class Program
{
    static void Main(string[] args)
    {
        Console.WriteLine("");

        SimpleVector v1 = new SimpleVector(-12, 124);
        Console.WriteLine(" v1   : {0}, Hash = {1}", v1, v1.GetHashCode());

        SimpleVector v2 = new SimpleVector(-11, 124);
        Console.WriteLine(" v2   : {0}, Hash = {1}", v2, v2.GetHashCode());

        SimpleVector v3 = new SimpleVector(-12, 124);
        Console.WriteLine(" v3   : {0}, Hash = {1}", v3, v3.GetHashCode());


        Console.WriteLine("\n\n *** Vergleiche *** \n");
        Console.WriteLine(" v1.Equals(v1)   : " + v1.Equals(v1));
        Console.WriteLine(" v1.Equals(null) : " + v1.Equals(null));
        Console.WriteLine(" v1.Equals(v2)   : " + v1.Equals(v2));
        Console.WriteLine(" v2.Equals(v1)   : " + v2.Equals(v1));
        Console.WriteLine(" v1.Equals(v3)   : " + v1.Equals(v3));
        Console.WriteLine(" v3.Equals(v1)   : " + v3.Equals(v1));
    }
}
