Esempio n. 1
0
        static void Main(string[] args)
        {
            Product product1 = new Product();

            product1.UrunAdı  = "Elma";
            product1.Fıyat    = 15;
            product1.Acıklama = "amasya elması";

            Product product2 = new Product();

            product2.UrunAdı  = "Karpuz";
            product2.Fıyat    = 20;
            product2.Acıklama = "Diyarbakır Karpuzu";

            Product[] products = new Product[] { product1, product2 };

            foreach (Product product in products)
            {
                Console.WriteLine(product.UrunAdı);
                Console.WriteLine(product.Fıyat);
                Console.WriteLine(product.Acıklama);
                Console.WriteLine("*********************");
            }

            Console.WriteLine("----------Metotlar------------");


            BasketManager basketManager = new BasketManager();

            basketManager.Ekle(product1);
            basketManager.Ekle(product2);
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            string[] fruits = new string[] { };

            Product product1 = new Product();

            product1.Name  = "Elma";
            product1.Price = 15;
            product1.Info  = "Amasya Elması";

            Product product2 = new Product();

            product2.Name  = "Karpuz";
            product2.Price = 21;
            product2.Info  = "Diyarbakır karpuzu";


            Product[] products = new Product[] { product1, product2 };

            //type-safe -- tip güvenli
            foreach (var product in products)
            {
                Console.WriteLine(product.Name);
                Console.WriteLine(product.Price);
                Console.WriteLine(product.Info);
                Console.WriteLine("--------------------");
            }

            Console.WriteLine("------------------Metotlar----------------------");

            //encapsulation
            //instance - örnek
            BasketManager basketmanager = new BasketManager();

            basketmanager.Add(product1);
            basketmanager.Add(product2);


            basketmanager.Add2("Armut", "Yeşil armut", 12, 23);
            basketmanager.Add2("Elma", "Yeşil elma", 15, 21);
            basketmanager.Add2("Karpuz", "Diyarbakır", 5, 54);
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            // Do not repeat yourself !
            // Clean code principles

            Product product1 = new Product();

            product1.Name        = "Elma";
            product1.Price       = 15;
            product1.Description = "Amasya Elması";

            Product product2 = new Product();

            product2.Name        = "Karpuz";
            product2.Price       = 80;
            product2.Description = "Diyarbakır karpuzu";

            Product[] products = new Product[] { product1, product2 };

            foreach (Product product in products)
            {
                Console.WriteLine(product.Name + " - " + product.Price);
                Console.WriteLine(product.Description);
                Console.WriteLine("--------------");
            }


            Console.WriteLine("----------Metotlar----------");
            BasketManager basketManager = new BasketManager();

            basketManager.Add(product1);
            basketManager.Add(product2);



            Console.Read();
        }