コード例 #1
0
 public Knopka(Knopka ren) // констр копиров
 {
     this.Raspoloz = ren.Raspoloz;
     this.Color    = ren.Color;
     this.Text     = ren.Text;
     this.CanPush  = ren.CanPush;
 }
コード例 #2
0
        static void Main(string[] args)
        {
            Knopka ruch = new Knopka();

            ruch.Push();

            Knopka ras = new Knopka();      //instance

            WriteLine("Кнопка находится: ");

            string rnd;
            Random rand = new Random();

            int val = rand.Next(0, 2);

            if (val == 0)
            {
                rnd = "left";
            }
            else if (val == 1)
            {
                rnd = "center";
            }
            else
            {
                rnd = "right";
            }

            ras.ChangePol(rnd);

            Knopka puch = new Knopka();

            puch.Push();
            puch.Push(4);

            Knopka color = new Knopka();

            WriteLine("She has: " + color.Color + " color.");

            Knopka text = new Knopka();

            WriteLine("Введите текст: ");
            string strText = ReadLine();

            text.Text = strText;
            WriteLine(text.Text);
        }