定义的类如下:

    using System; 
    using System.Collections.Generic; 
    using System.Linq; 
    using System.Text; 
    
    namespace HelloWorld 
    { 
        public class ChinaElectricity : IChinaElectricity 
        { 
            public int Voltage() 
            { 
                return 220; 
            } 
        } 
    
        public class JapanElectricity : IJapanElectricity 
        { 
            public int Voltage() 
            { 
                return 110; 
            } 
        } 
    
        public class ChinaLight : IChinaLight 
        { 
            /// <summary> 
            /// 发光 
            /// </summary> 
            /// <returns></returns> 
            public string Light(int voltage) 
            { 
                if (voltage == 220) 
                { 
                    return "我发光啦...."; 
                } 
                else
                { 
                    return ("电压不正确,无法正常工作..."); 
                } 
            } 
        } 
        /// <summary> 
        /// 定义一个电压适配器 
        /// </summary> 
        public class ElectricityAdapter : IChinaElectricity 
        { 
            private int voltage = 0; 
            private IJapanElectricity iJElectricity = null; 
             
            public ElectricityAdapter(IJapanElectricity _baseElectricity) 
            { 
                iJElectricity = _baseElectricity; 
                voltage = this.iJElectricity.Voltage(); 
            } 
            public int Voltage() 
            { 
                return voltage + 110; 
            } 
        } 
    }