示例#1
0
    public static void Main()
    {
        IShape  LineShape      = new Line(1, 2, 3, 4);
        IShape  RactangleShape = new Ractangle();
        Complex complexShape   = new Complex();

        complexShape.AddToShape(LineShape);
        complexShape.AddToShape(RactangleShape);

        LineShape.Show();
        RactangleShape.Show();
        complexShape.Show();
    }
示例#2
0
    static void Main(string[] args)
    {
        Squre     sqr = new Squre();
        Ractangle rac = new Ractangle();

        int g, p, e;

        Console.WriteLine("Квадрат розміру N:");
        g = Convert.ToInt32(Console.ReadLine());
        sqr.Drav(g);

        Console.WriteLine("Прямокутник висота і довжина відповідно:");
        p = Convert.ToInt32(Console.ReadLine());
        e = Convert.ToInt32(Console.ReadLine());
        rac.Drav(p, e);
        Console.ReadKey();
    }
示例#3
0
        static void Main(string[] args)
        {
            Program obj = new Program();
            //AddDelegate ad = new AddDelegate(obj.Add);
            //GreetingsDelegate gd = new GreetingsDelegate(Program.Greetings);
            //ad(100, 50);
            //ad.Invoke(10,12);
            //ad.Invoke(100, 120);
            //// string GreetingsMessage = gd.Invoke("Pranaya");
            //Console.WriteLine(gd.Invoke("limon"));
            Ractangle ract = new Ractangle(obj.GetArea);

            ract += GetPerimeter;
            ract.Invoke(12, 12);
            ract -= GetPerimeter;
            Console.ReadKey();
        }
示例#4
0
    static void Main()
    {
        Ractangle rect = new Ractangle(10, 23);
        int       area;
        bool      isSqr;

        area = rect.RectInfo(out isSqr);
        if (isSqr)
        {
            Console.WriteLine("rect is a square.");
        }
        else
        {
            Console.WriteLine("rect is not square.");
        }

        Console.WriteLine("Its area is " + area + ".");
    }