using System; //using System.Collections.Generic; //using System.Text; namespace Cours1 { class Point { public virtual void display() { Console.WriteLine("({0}, {1})", my_x, my_y); } public int my_x; public int my_y; } class ColorPoint : Point { public override void display() { Console.WriteLine("({0}, {1}, {2})", my_x, my_y, my_color); } public int my_color; } class Cercle { public Cercle(int cx, int cy, float rad) { centerX = cx; centerY = cy; radius = rad; } public Cercle(Point c, float rad) { centerX = c.my_x; centerY = c.my_y; radius = rad; } public int centerX { get { return my_center.my_x; } set { my_center.my_x = value; } } public int centerY { get { return my_center.my_y; } set { my_center.my_y = value; } } public float radius { get { return radius; } set { my_radius = value; } } public float area() { return pi * my_radius * my_radius; } private const float pi = 3.14f; private Point my_center = new Point(); private float my_radius=0; }; class Program { static int access(int[] t) { return t[9]; } static void displayPoint(Point p) { p.display(); } static void Main(string[] args) { ColorPoint p = new ColorPoint(); Point p2 = new Point(); displayPoint(p); Point[] test ={ p, p2 }; Cercle c = new Cercle(p,3); Console.WriteLine("Result: {0}", c.area()); Console.ReadLine(); //string f = Console.ReadLine(); //double value; //value=Convert.ToDouble(f); //Console.WriteLine("Result:{0}", value); //Console.ReadLine(); //int [] t =new int[3]; //try //{ // access(t); //} //catch (Exception e) //{ // Console.WriteLine("Probleme..."); //} } } }