コード例 #1
0
        /// <summary>
        /// Method that lists the steps in a phone's repair
        /// Any phone model that IMPLEMENTS all the methods of the interface IPhone can be INSERTED AS DEPENDENCIES to this method.
        /// This would be the common set of steps in the repair
        /// </summary>
        /// <param name="phone">Any class that implements the IPhone interface</param>
        public void RepairSteps(IPhone phone)
        {
            string part1 = phone.GetPhonePart1();

            Console.WriteLine(string.Format("{0} repaired", part1));

            double partCost = phone.GetPart1Cost();

            Console.WriteLine(string.Format("Repair cost {0}", partCost * 0.5));
        }
コード例 #2
0
        ///<summary>
        ///Method that list the steps in phone repair
        ///Any phone model that IMPLEMENTS all the methods of tyhe interfaces IPhone can be inserted as dependencies to this method.
        ///This would be the common set of steps in the repair.
        ///</summary>
        ///<param name="phone">Any class that implements the IPhone interfaces</param>
        public void RepairSteps(IPhone phone)
        {
            string part1 = phone.GetPhonePart1();

            Console.WriteLine($"{part1} repaired");

            double partCost = phone.GetPart1Cost();

            Console.WriteLine($"Repair Cost: {partCost * 0.5}");
        }