예제 #1
0
        // реализация интерфейса ICloneable
        public object Clone()
        {
            var result = new RecordingStudio(Name, Address, TrackCost, TrackTime, SalaryWorker, Account, RoomCost, ToolCost);

            result.AmountWorkers = AmountWorkers;
            result.AmountRooms   = AmountRooms;
            result.AmountTools   = AmountTools;

            return(result);
        }
예제 #2
0
        static void Main(string[] args)
        {
            RecordingStudio studio = new RecordingStudio("909", "LudvigaSvobody", 100, 250, 50, 10000, 10, 2);

            studio.AddWorker();
            studio.AddWorker();
            studio.AddWorker();
            studio.AddWorker();
            studio.AddRoom();
            studio.AddRoom();
            var result = studio.ProfitForMonth();

            RecordingStudio studio2 = (RecordingStudio)studio.Clone();

            studio2.AddWorker();
            studio2.AddRoom();

            for (int i = 0; i <= studio.AmountRooms; i++)
            {
                studio.RemoveRoom();
            }
        }