Esempio n. 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));
        }
Esempio n. 2
0
        public static void ShowPoint()
        {
            Point p = new ColouredPoint(7, 5, "Red");

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

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

            Console.WriteLine(sum(p, cp));
        }
Esempio n. 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));
        }
Esempio n. 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));
        }
Esempio n. 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));
            }
        }
Esempio n. 7
0
 private static bool IsRed(ColouredPoint p)
 {
     return(p.Colour.Equals("Red"));
 }