예제 #1
0
        //---- COURS 3 -----
        // UML
        //---- COURS 4 -----
        // Probleme avec la librarie Systeme.Drawing chez moi donc j'ai mis
        // les couleurs en String

        public static void PointTranslation()
        {
            ColouredPoint cp = new ColouredPoint(1, 2, "Red");

            Console.WriteLine(cp);
            Console.WriteLine(cp.Translate(1, 0));
        }
예제 #2
0
        public static void ShowPoint()
        {
            Point p = new ColouredPoint(7, 5, "Red");

            Console.WriteLine(p.ToString());
            Console.WriteLine(p);             // ToString from ColouredPoint
        }
예제 #3
0
        public static void SumOfPoint()
        {
            Point p = new Point(3, 5);

            ColouredPoint cp = new ColouredPoint(1, 2, "Red");

            Console.WriteLine(sum(p, cp));
        }
예제 #4
0
        public static void RealTypeOfPoint()
        {
            ColouredPoint cp = new ColouredPoint(1, 2, "Red");

            Console.WriteLine((cp is Point) + " / " + (cp is ColouredPoint));

            Console.WriteLine(cp.GetType() == typeof(Point));
            Console.WriteLine(cp.GetType() == typeof(ColouredPoint));
        }
예제 #5
0
        public static void PolymorfPoint()
        {
            Point p = new Point(3, 5);

            ColouredPoint cp = new ColouredPoint(1, 2, "Red");

            Console.WriteLine((p is Point) + " / " + (p is ColouredPoint));
            Console.WriteLine((cp is Point) + " / " + (cp is ColouredPoint));
        }
예제 #6
0
        public static void ColorOfPoint()
        {
            Point q = new ColouredPoint(1, 2, "Red");

            if (q is ColouredPoint)
            {
                ColouredPoint cp = (ColouredPoint)q;
                Console.WriteLine(IsRed(cp));
            }
        }
예제 #7
0
 private static bool IsRed(ColouredPoint p)
 {
     return(p.Colour.Equals("Red"));
 }