Пример #1
0
        static void Main(string[] args)
        {
            Chair firstChair = new Chair();

            firstChair.Color    = "oranzova";
            firstChair.LegCount = 4;
            firstChair.Back     = Chair.BackType.Rounded;

            firstChair.PullChair();

            Console.WriteLine($"First chair is {firstChair.State}");

            Chair secondChair = new Chair();

            secondChair.Color    = "Light biege";
            secondChair.Back     = Chair.BackType.Rectangle;
            secondChair.LegCount = 4;

            // note 50 does not create an array of 50 chairs, it just prepares the list for 50 items
            List <Chair> allChairsInRoom = new List <Chair>(50);

            allChairsInRoom.Add(firstChair);
            allChairsInRoom.Add(secondChair);

            Table firstTable = new Table();

            firstTable.LegCount         = 6;
            firstTable.HasPrivacyShield = true;
            firstTable.Color            = "Dark Brown";

            foreach (Chair chair in allChairsInRoom)
            {
                Console.WriteLine($"Chair has color {chair.Color}, back is of type {chair.Back} and leg count is {chair.LegCount}");
            }
        }