Пример #1
0
        static void Main(string[] args)
        {
            ConcreteCustomer   cust   = new ConcreteCustomer();
            ConcreteContact    cont   = new ConcreteContact();
            ConcreteIncomeData inData = new ConcreteIncomeData();

            Console.WriteLine("Вызов методов Customer:");
            Console.WriteLine(cust.getCompanyName());
            Console.WriteLine(cust.getCountryName());
            Console.WriteLine();

            Console.WriteLine("Вызов методов Contact:");
            Console.WriteLine(cont.getName());
            Console.WriteLine(cont.getPhoneNumber());
            Console.WriteLine();

            IncomeDataAdapter adapter = new IncomeDataAdapter(inData);

            Console.WriteLine("Вызов методов через адаптер:");
            Console.WriteLine(adapter.getCompanyName());
            Console.WriteLine(adapter.getCountryName());
            Console.WriteLine(adapter.getName());
            Console.WriteLine(adapter.getPhoneNumber());

            Console.ReadKey();
        }
Пример #2
0
        public static void Main()
        {
            countries.Add("UA", "Ukraine");
            countries.Add("RU", "Russia");
            countries.Add("CA", "Canada");
            IncomeDataAdapter adaper = new IncomeDataAdapter(new IncomDataRealization("UA", "Java Rush Ltd", "John", "Doe", 38, 12345678));

            Console.WriteLine(adaper.getCountryName());
            Console.WriteLine(adaper.getCompanyName());
            Console.WriteLine(adaper.getName());
            Console.WriteLine(adaper.getPhoneNumber());

            Console.ReadKey();
        }