示例#1
0
        static void Main(string[] args)
        {
            //int sayı1 = 10;
            //int sayı2 = 20;

            //sayı1 = sayı2;
            //sayı2 = 100;

            //console.writeline("sayı 1 : " + sayı1);

            //int[] sayılar1 = new int[] { 1,2,3 };
            //int[] sayılar2 = new int[] { 10, 20, 30 };

            //sayılar1 = sayılar2;
            //sayılar2[0] = 1000;
            //console.writeline(sayılar1[0]);



            Person person1 = new Person();
            Person person2 = new Person();

            person1.FirstName = "Batuhan";


            person2           = person1;
            person1.FirstName = "Engin";



            Console.WriteLine(person2);


            Person person = new Person();

            Custumer custumer = new Custumer();

            custumer.FirstName        = "Salih";
            custumer.CreditCardNumber = "123345678901";

            Employee employee = new Employee();

            employee.FirstName = "Veli";

            Person person3 = custumer;

            custumer.FirstName = "Ahmet";


            Console.WriteLine(((Custumer)person3).CreditCardNumber);

            PersonManager personManager = new PersonManager();

            personManager.Add(person3);
        }
示例#2
0
        static void Main(string[] args)
        {
            ////int, decimal, float, enum, boolean value types
            //int sayi1 = 10;
            //int sayi2 = 20;

            //sayi1 = sayi2;

            //sayi2 = 100;

            //Console.WriteLine("Sayi 1 = " + sayi1);


            ////arrays, class, interface... referans types

            //int[] sayilar1 = new int[] { 1, 2, 3 };
            //int[] sayilar2 = new int[] { 10, 20, 30 };

            //sayilar1 = sayilar2;
            //sayilar2[0] = 1000;

            //Console.WriteLine("Sayılar 1 [0] = " + sayilar1[0]);


            Person person1 = new Person();
            Person person2 = new Person();

            person1.FirstName = "Kerem";

            person2           = person1;
            person1.FirstName = "Barış";

            //Console.WriteLine(person2.FirstName);


            Customer customer = new Customer();

            customer.FirstName        = "Doğan";
            customer.CreditCardNumber = 1234567890;

            Employee employee = new Employee();

            employee.FirstName = "Veli";

            Person person3 = customer;

            customer.FirstName = "Ahmet";


            //Console.WriteLine(((Customer)person3).CreditCardNumber);

            PersonManager personManager = new PersonManager();

            personManager.Add(employee);
        }
示例#3
0
        static void Main(string[] args)
        {
            //int, decimal, bool, float, enum... value types
            //arrays, classes, interfaces... reference types


            //int sayi1 = 10;
            //int sayi2 = 20;

            //sayi1 = sayi2;

            //sayi2 = 100;

            //Console.WriteLine("Sayı1 = " + sayi1);

            //int[] sayilar1 = new int[] { 1, 2, 3 };
            //int[] sayilar2 = new int[] { 10, 20, 30 };

            //sayilar1 = sayilar2;

            //sayilar2[0] = 1000;

            //Console.WriteLine("Sayilar1 [0] = " + sayilar1[0]);

            //Console.WriteLine();

            Person person1 = new Person();
            Person person2 = new Person();

            person2           = person1; //Burada değer eşitlemesi değil referans eşitlemesi yapılıyor.
            person1.FirstName = "Derin";

            //Console.WriteLine(person2.FirstName);

            Customer customer = new Customer();

            customer.FirstName        = "Salih";
            customer.CreditCardNumber = "65489632514";
            Employee employee = new Employee();

            employee.FirstName = "Ahmet";
            Person person3 = customer;

            //Console.WriteLine(((Customer)person3).CreditCardNumber);

            PersonManager personManager = new PersonManager();

            personManager.Add(person3);
            personManager.Add(customer);
            personManager.Add(employee);


            Console.ReadLine();
        }
示例#4
0
        //int,decimal,float,enum,boolean values types
        static void Main(string[] args)
        {
            int sayi1 = 10;
            int sayi2 = 20;

            sayi1 = sayi2;

            sayi2 = 100;

            Console.WriteLine("Sayı 1 : " + sayi1);

            //arrays,class,interface... reference types

            int[] sayilar1 = new int[] { 1, 2, 3 };
            int[] sayilar2 = new int[] { 10, 20, 30 };

            sayilar1    = sayilar2;
            sayilar2[0] = 1000;

            Console.WriteLine("Sayılar1[0] = " + sayilar1[0]);

            Person person1 = new Person();
            Person person2 = new Person();

            person1.FirstName = "Bircan";
            //reference tip olduğu için referans numaraları üzerinden gider o yüzden person2 ninde firsrname i bircan dır.
            person2           = person1;
            person1.FirstName = "Derin"; //bu şekilde değiştirdiğimde person2 ninde firstname i derin olarak değişir

            Console.WriteLine(person2.FirstName);

            Customer customer = new Customer();

            customer.FirstName        = "Serhat";
            customer.CreditCardNumber = "1234567890"; //aynı adrese gittiği için aynı adresteki creditcardnumber a ulaşabiliriz.

            Employee employee = new Employee();

            employee.FirstName = "Ömer";

            Person person3 = customer;   //custemor bir person olduğu için atama yapabiliriz.Referansını atayabiliriz

            customer.FirstName = "Onur"; //referans üzerinden gitti için aynı adresi değiştirmiş oluruz serhat onur olarak değişir

            //person3 e customer boxing i yap demiş oluyoruz.Boxing:Kutu, şablon

            /*person önüne atanabilirlerden istediğimizin tipi yazabiliyoruz.() ikinci parantez en
             * genel parantez olur ve customer boxing e uygulanır olur*/
            Console.WriteLine(((Customer)person3).CreditCardNumber); //şeklinde person3 de credicardnumber na erişebiliriz.

            PersonManager personManager = new PersonManager();

            personManager.Add(customer);
        }
示例#5
0
        static void Main(string[] args)
        {
            //int sayi1 = 10;
            //int sayi2 = 20;
            //sayi1 = sayi2;

            //sayi2 = 100;

            //Console.WriteLine("Sayı 1:"+sayi1 );

            //int[] sayilar1 = new int[] { 1,2,3};
            //int[] sayilar2 = new int[] { 10, 20, 30 };
            //sayilar1 = sayilar2;
            //sayilar2[0] = 1000;


            //Console.WriteLine("Sayılar1[0] = "+ sayilar1[0]);

            Person person1 = new Person();
            Person person2 = new Person();

            person1.FirstName = "Sezin";

            person2           = person1;
            person1.FirstName = "Rezzan";

            Console.WriteLine(person2.FirstName);

            Customer customer = new Customer();

            customer.FirstName        = "Nurten";
            customer.CreditCardNumber = 1234567890;

            Employee employee = new Employee();

            employee.FirstName = "Yılmaz";



            Person person3 = customer;

            customer.FirstName = "Özkan";

            Console.WriteLine(person3.FirstName);


            Console.WriteLine(((Customer)person3).CreditCardNumber);

            PersonManager personManager = new PersonManager();

            personManager.Add(person3);
            personManager.Add(employee);
            personManager.Add(customer);
        }
示例#6
0
        static void Main(string[] args)
        {
            //int, decimal, float,enum,boolean değer tiptir (value types)
            int sayi1 = 10;
            int sayi2 = 20;

            sayi1 = sayi2;
            sayi2 = 100;
            //Console.WriteLine(sayi1);

            //arrays,class,interface... reference types
            //int[] array sayıldığğı için yukardaki yaptığımız gibi olmaz sonuç
            int[] sayilar1 = new int[] { 1, 2, 3 };
            int[] sayilar2 = new int[] { 10, 20, 30 };

            sayilar1    = sayilar2;
            sayilar2[0] = 1000;
            //Console.WriteLine(sayilar1[0]);

            Person person1 = new Person();
            Person person2 = new Person();

            person1.FirstName = "Engin";

            person2           = person1;
            person1.FirstName = "Derin"; // ben değiştirdikçe onlar da değişiyor.

            //Console.WriteLine(person2.FirstName);


            Customer customer = new Customer();

            customer.FirstName        = "Salih";
            customer.CreditCardNumber = "4742749234";

            Employee employee = new Employee();

            employee.FirstName = "Veli";

            Person person3 = customer;

            customer.FirstName = "Ahmet";

            //Console.WriteLine(person3.FirstName);
            //Console.WriteLine(((Customer)person3).CreditCardNumber);

            PersonManager personManager = new PersonManager();

            personManager.Add(employee); //employee yerine customer de yazabilirim.

            //customer = employee; yazarsam kabul etmez
            //employee ile customeri birbirine atıyamıyorken person ile customeri birbirine atıyabiliyorum
            //çünkü customer:person yazmıştım.
        }
示例#7
0
        static void Main(string[] args)
        {
            ////int, decimal, float, enum, boolean -----> value types
            //int sayi1 = 10;
            //int sayi2 = 20;

            //sayi1 = sayi2;

            //sayi2 = 100;

            //Console.WriteLine("Sayı 1 : " +sayi1);
            ////sayi1 = ?


            ////arrays, class, interface... -----> reference types
            //int[] sayilar1 = new int[] { 1, 2, 3 };
            //int[] sayilar2 = new int[] { 10, 20, 30 };

            //sayilar1 = sayilar2;
            //sayilar2[0] = 1000;

            //Console.WriteLine("Sayılar1[0] = "+ sayilar1[0]);

            Person person1 = new Person();
            Person person2 = new Person();

            person1.FirstName = "Kemal";

            person2           = person1;
            person1.FirstName = "Barış";

            Console.WriteLine(person2.FirstName);


            Customer customer = new Customer();

            customer.FirstName        = "Lefter";
            customer.CreditCardNumber = "1234567890";

            Employee employee = new Employee();

            employee.FirstName = "Özil";

            Person person3 = customer;

            customer.FirstName = "Can";

            Console.WriteLine(person3.FirstName);
            Console.WriteLine(((Customer)person3).CreditCardNumber);               //Burası çok önemli. 'Boxing' yapıyoruz !!!

            PersonManager personManager = new PersonManager();

            personManager.Add(employee);
        }
示例#8
0
        static void Main(string[] args)
        {
            //int, decimal, float, enum, boolean value types
            //int sayi1 = 10;
            //int sayi2 = 20;

            //sayi1 = sayi2;

            //sayi2 = 100;

            //Console.WriteLine("sayi 1: " + sayi1);

            ////array, class interface... reference types

            //int[] sayilar1 = new int[] { 1, 2, 3 };
            //int[] sayilar2 = new int[] { 10, 20, 30 };

            //sayilar1 = sayilar2;
            //sayilar2[0] = 1000;

            //Console.WriteLine("sayilar1[0] = " + sayilar1[0]);

            Person person1 = new Person();
            Person person2 = new Person();

            person1.FirtstName = "Enes";

            person2            = person1;
            person1.FirtstName = "Etka";

            Console.WriteLine(person2.FirtstName);

            Customer customer = new Customer();

            customer.FirtstName       = "Salih";
            customer.CreditCardNumber = "1234567890";

            Employee employee = new Employee();

            employee.FirtstName = "Ramiz";

            // customer = employee; //Bu sekilde bir atama yapamayiz. Nasil ki string ve int farkli türlerdir, burada da customer ve employee farkli türler

            Person person3 = customer;   // Bu sekilde bir atama yapilabilir cünkü inheritance sebebi ile her customer ayni zamanda bir person olur.

            customer.FirtstName = "Ahmet";

            //Console.WriteLine(((Customer)person3).CreditCardNumber);

            PersonManager personManager = new PersonManager();

            personManager.Add(customer);
        }
示例#9
0
        static void Main(string[] args)
        {
            //int,decimal,float,enum,boolean... value types
            int sayi1 = 10;
            int sayi2 = 20;

            sayi1 = sayi2;
            sayi2 = 100;

            Console.WriteLine("Sayi1: " + sayi1);

            //array,class,interface... reference types

            int[] sayilar1 = new int[] { 1, 2, 3, };
            int[] sayilar2 = new int[] { 10, 20, 30 };

            sayilar1    = sayilar2;
            sayilar2[0] = 1000;

            Console.WriteLine("Sayilar1[0]= " + sayilar1[0]);
            Console.WriteLine("----------");

            Person person1 = new Person();
            Person person2 = new Person();

            person1.FirstName = "Engin";

            person2           = person1;
            person1.FirstName = "Derin";

            Console.WriteLine(person2.FirstName);

            Customer customer = new Customer();

            customer.FirstName        = "Salih";
            customer.CreditCardNumber = "1234567890";

            Employee employee = new Employee();

            employee.FirstName = "Veli";

            Person person3 = customer;

            customer.FirstName = "Ahmet";


            Console.WriteLine(((Customer)person3).CreditCardNumber);

            PersonManager personManager = new PersonManager();

            personManager.Add(customer);
            personManager.Add(employee);
        }
示例#10
0
文件: Program.cs 项目: Ozman-e/Ders
        static void Main(string[] args)
        {
            ////int,decimal,float,enum,boolean, value types (değer tiplerdir)
            //int sayi1 = 10;
            //int sayi2 = 20;

            //sayi1 = sayi2; //sayı1'i sayi2'nin değerine eşitliyosun. sayı2 ile bi alakası kalmıyor sadece değeriyle bağlantılı. o yüzden sayı2'
            ////yi sonradan değiştirmen sayı1'i değiştirmez. bu değer tipler için böyledir.

            //sayi2 = 100;
            //console.writeline("sayı1" + sayi1);

            ////arraylar[ [] ),class,interface reference types (referans tiplerdir. adres tutuyor. yukarıdaki gibi işlemez)

            //int[] sayilar1 = new int[] { 1, 2, 3, };
            //int[] sayilar2 = new int[] { 10, 20, 30 };

            //sayilar1 = sayilar2; //sayılar1'in adresi = sayılar2'nin adresi
            //sayilar2[0] = 1000;

            //console.writeline("sayılar 1[0] = " + sayilar1[0]);

            Person person1 = new Person();
            Person person2 = new Person();

            person1.FirstName = "Engin";

            person2           = person1;
            person1.FirstName = "Derin";

            Console.WriteLine(person2.FirstName); //referans tip olduğu için adresi değiştirdik anlamına geliyor.


            Employee employee = new Employee();

            employee.FirstName = "Ahmet";

            Customer customer = new Customer();

            customer.FirstName        = "Salih";
            customer.CreditCardNumber = "232432532";

            Person person3 = customer;

            Console.WriteLine(person3.FirstName);

            Console.WriteLine(((Customer)person3).CreditCardNumber);

            PersonManager personmanager = new PersonManager();

            personmanager.Add(customer); //hepsini yollayabiliyorsun (customer person employee)
        }
示例#11
0
        static void Main(string[] args)
        {
            ////Value Types -- int, decimal, enum, boolean
            //int sayi1 = 10;
            //int sayi2 = 20;
            //sayi1 = sayi2;
            //sayi2 = 30;
            //Console.WriteLine("Sayı1 = " + sayi1); //20

            ////Reference Types -- arrays, class, interface
            //int[] sayi3 = new int[] {4, 5, 6};
            //int[] sayi4 = new int[] {100, 200, 300};
            //sayi3 = sayi4;
            //sayi4[0] = 1500;

            //Console.WriteLine("Sayi4[0] = " + sayi4[0]); //1500

            Person person1 = new Person();
            Person person2 = new Person();

            person1.FirstName = "Gizem";

            person2           = person1;
            person1.FirstName = "Alparslan";

            Console.WriteLine(person2.FirstName); //Class'lar referans tip olduğu için Alparslan yazdırır.


            Customer customer = new Customer();

            customer.FirstName        = "Ali";
            customer.CreditCardNumber = "1234667";

            Employee employee = new Employee();

            employee.FirstName = "Veli";

            //customer=employee //bunu yapamayız çünkü ikisi farklı tipler. biri string biri int gibi düşün..

            Person person3 = customer;                               //burada hata vermez çünkü customer'ı person olarak implemente ettik..

            customer.FirstName = "Ahmet";                            //person3 customer'ın adresini tutuyor
            Console.WriteLine(person3.FirstName);                    //önce ali sonra ahmet yazdırır.

            Console.WriteLine(((Customer)person3).CreditCardNumber); //person3'e Customer BOXING'i yaptık

            PersonManager personManager = new PersonManager();

            personManager.Add(person3);
            personManager.Add(customer);
            personManager.Add(employee); //Üçünü de kabul ediyor çünkü person hepsini kapsıyor.
        }
示例#12
0
        static void Main(string[] args)
        {
            // int, decimal, float, enum, boolean   value types (değer tip)
            int sayi1 = 10;
            int sayi2 = 20;

            sayi1 = sayi2;
            sayi2 = 100;

            Console.WriteLine("sayi1 :" + sayi1);


            int[] sayilar1 = new int[] { 1, 2, 3 };
            int[] sayilar2 = new int[] { 10, 20, 30 };

            sayilar1    = sayilar2;
            sayilar2[0] = 1000;

            Console.WriteLine("sayilar1[0] = " + sayilar1[0]);

            Person person  = new Person();
            Person person1 = new Person();
            Person person2 = new Person();

            person1.FirstName = "Engin";

            person2           = person1;
            person1.FirstName = "Derin";

            Console.WriteLine(person2.FirstName);

            Customer customer = new Customer();

            customer.FirstName        = "Salih";
            customer.CreditcardNumber = "1234567890";

            Person person3 = customer;

            customer.FirstName = "Ahmet";

            Console.WriteLine(person3.FirstName);

            // Console.WriteLine(((Customer)person3).CreditCardNumber);

            PersonManager personManager = new PersonManager();

            personManager.Add(person3);

            Employee employee = new Employee();

            employee.FirstName = "Veli";
        }
示例#13
0
        static void Main(string[] args)
        {
            //int, decimal, float, boolean are value types

            //int sayi1 = 10;
            //int sayi2 = 20;

            //sayi1 = sayi2;

            //sayi2 = 100;

            //Console.WriteLine(sayi1);


            ////arrays, classes, interfaces are reference types

            //int[] sayilar1 = new int[] { 1, 2, 3 };
            //int[] sayilar2 = new int[] { 10, 20, 30 };

            //sayilar1 = sayilar2;
            //sayilar2[0] = 1000;

            //Console.WriteLine(sayilar1[0]);


            Person person1 = new Person();
            Person person2 = new Person();

            person1.FirstName = "Engin";

            person2           = person1;
            person1.FirstName = "Derin";

            //Console.WriteLine(person2.FirstName);


            Customer customer = new Customer();

            customer.FirstName        = "Salih";
            customer.CreditCardNumber = "256421";

            Employee employee = new Employee();

            employee.FirstName = "Ahmet";

            Person person3 = customer;
            //Console.WriteLine(((Customer)person3).CreditCardNumber); //class boxing

            PersonManager personManager = new PersonManager();

            personManager.Add(employee); //we can send person, customer or employee, we can work same code for different objects
        }
示例#14
0
        static void Main(string[] args)
        {
            ////int,decimal,float,enum,boolean value types
            //int sayi1 = 10;
            //int sayi2 = 20;

            //sayi1 = sayi2;
            //sayi2 = 100;
            //Console.WriteLine("Sayı 1 : "+ sayi1); // Sayı birin değeri kaç olur?

            ////arrays,class,interface... reference types
            //int[] sayilar1 = new int[] { 1, 2, 3 };
            //int[] sayilar2 = new int[] { 10, 20, 30 };

            //sayilar1 = sayilar2;
            //sayilar2[0] = 1000;

            //Console.WriteLine("Sayılar1[0] = " + sayilar1[0]); //Sayılar birin ilk endeksindeki değer nedir?

            Person person1 = new Person();
            Person person2 = new Person();

            person1.FirstName = "Engin";

            person2           = person1; //Person 2'nin referans değerini person1'e eşitliyoruz.
            person1.FirstName = "Derin"; //Person 2'ninde FirstName değeri Derin olarak değişir.

            Console.WriteLine(person2.FirstName);



            Customer customer = new Customer();

            customer.FirstName        = "Salih";
            customer.CreditCardNumber = "1234567890";

            Employee employee = new Employee();

            employee.FirstName = "Veli";

            Person person3 = customer;  //Customer bir person olduğu için bu eşitlemeyi yapabiliyoruz.

            customer.FirstName = "Ahmet";



            Console.WriteLine(((Customer)person3).CreditCardNumber);  // Person3.CreditCardNumbers'a ulaşmak için yapılan boxing işlemi.
            PersonManager personManager = new PersonManager();

            personManager.Add(employee);
        }
示例#15
0
        static void Main(string[] args)
        {
            //// int, decimal, float, enum, boolean -> value type
            //int sayi1 = 10;
            //int sayi2 = 20;

            //sayi1 = sayi2;
            //sayi2 = 100;

            //Console.WriteLine("Say1 1 : " + sayi1);

            //// array, class, Interface -> reference types

            //int[] sayilar1 = new int[] { 1, 2, 3 };
            //int[] sayilar2 = new int[] { 10, 20, 30 };

            //sayilar1 = sayilar2;
            //sayilar2[0] = 1000;

            //Console.WriteLine("sayilar1[0] : " + sayilar1[0]);

            Person person1 = new Person();
            Person person2 = new Person();

            person1.FirstName = "Engin";
            person2           = person1;
            person1.FirstName = "Derin";
            //Console.WriteLine(person2.FirstName);

            Customer customer = new Customer();

            customer.FirstName        = "Salih";
            customer.CreditCardNumber = "123456678";

            Employee employee = new Employee();

            employee.FirstName = "Veli";

            Person person3 = customer;

            customer.FirstName = "Ahmet";


            //Console.WriteLine(((Customer)person3).CreditCardNumber);

            PersonManager personManager = new PersonManager();

            personManager.Add(employee); // person, customer, employee gönderebiliriz
            // person, customerın da employeeninde adresinin tutuyor
        }
示例#16
0
        static void Main(string[] args)
        {
            //int, decimal, float, enum, boolean = value types
            //int sayi1 = 10;
            //int sayi2 = 20;

            //sayi1 = sayi2;

            //sayi2 = 100;

            //Console.WriteLine("Sayı 1: "+sayi1);

            //arrays, class, interface... reference types
            //int[] sayilar1 = new int[] { 1, 2, 3 };
            //int[] sayilar2 = new int[] { 10, 20, 30 };

            //sayilar1 = sayilar2;
            //sayilar2[0] = 1000;

            //Console.WriteLine("Sayılar1[0]= "+sayilar1[0]);

            Person person1 = new Person();
            Person person2 = new Person();

            person1.FirstName = "Mustafa";

            person2           = person1;
            person1.FirstName = "Bilal";

            //Console.WriteLine(person2.FirstName);


            Customer customer = new Customer();

            //customer.FirstName = "Tuğba";
            customer.CreditCardNumber = "1234684646";
            Employee employee = new Employee();

            employee.FirstName = "Aysel";

            Person person3 = customer;

            customer.FirstName = "Burçak";

            //Console.WriteLine(((Customer)person3).CreditCardNumber);

            PersonManager personManager = new PersonManager();

            personManager.Add(employee);
        }
示例#17
0
        static void Main(string[] args)
        {
            ////int, decimal, float, enum, boolean, value types
            //int sayi1 = 10;
            //int sayi2 = 20;
            //sayi1 = sayi2;//sayi1 sayi2'nin değerini aldı 20 oldu
            //sayi2 = 100;
            //Console.WriteLine("sayi1: " + sayi1);

            ////arrays, class interface... reference types
            //int[] sayilar1 = new int[] { 1, 2, 3, 4 };
            //int[] sayilar2 = new int[] { 10, 20, 30, 40 };

            //sayilar1 = sayilar2;
            //sayilar2[0] = 1000;

            //Console.WriteLine("sayilar1[0]: " + sayilar1[0]);
            Person person1 = new Person();
            Person person2 = new Person();

            person1.FirstName = "Engin";
            person2           = person1;//Bellektte aynı yeri paylaşıyorlar
            person1.FirstName = "Derin";
            //Console.WriteLine(person2.FirstName+" "+person1.FirstName);//Bellektte aynı yeri paylaşıyorlar
            person2.FirstName = "Quality";
            //Console.WriteLine(person2.FirstName+" "+person1.FirstName);//Bellektte aynı yeri paylaşıyorlar


            Customer customer1 = new Customer();

            customer1.FirstName        = "Demir";
            customer1.CreditCardNumber = "45434545354546879";


            Employee employee1 = new Employee();
            Employee employee2 = new Employee();

            employee1.FirstName = "Ali Veli";

            Person person3 = customer1;

            //Console.WriteLine(person3.FirstName);
            //Console.WriteLine(((Customer)person3).CreditCardNumber);//Boxing yapımı

            PersonManager personManager = new PersonManager();

            personManager.Add(employee1);
            personManager.Add(customer1);
            personManager.Add(person3);
        }
示例#18
0
        static void Main(string[] args)
        {
            int sayi1 = 10;
            int sayi2 = 20;

            sayi1 = sayi2;
            sayi2 = 100;

            Console.WriteLine("Sayi1: " + sayi1); // Sonuç 20 olacak

            int[] sayilar1 = new int[] { 1, 2, 3 };
            int[] sayilar2 = new int[] { 10, 20, 30 };

            sayilar1    = sayilar2;
            sayilar2[0] = 1000;

            Console.WriteLine("Sayılar1[0]: " + sayilar1[0]); // Sonuç 1000 olacak

            Person person1 = new Person();
            Person person2 = new Person();

            person1.FirstName = "Batuhan";

            person2           = person1;
            person1.FirstName = "Derin";
            Console.WriteLine(person2.FirstName); // Sonuç Derin


            Customer customer = new Customer();

            customer.FirstName        = "Salih";
            customer.CreditCardNumber = "1234567890";

            Employee employee = new Employee();

            employee.FirstName = "Veli";

            Person person3 = customer;

            customer.FirstName = "Ahmet";
            Console.WriteLine(person3.FirstName); // Sonuç Salih

            //Boxing
            Console.WriteLine(((Customer)person3).CreditCardNumber);


            PersonManager personManager = new PersonManager();

            personManager.Add(customer);
        }
示例#19
0
        static void Main(string[] args)
        {
            int sayi1 = 10;
            int sayi2 = 20;

            sayi1 = sayi2;
            sayi2 = 100;
            Console.WriteLine("Sayi1 : " + sayi1); //20. Değer tip - int, decimal, float, enum, bool - Value Types
            // sayi1 in değeri eşittir 10
            //sayi1 in değeri eşittir sayi2 nin değeri. atama yaptıktan sonra bağlantı kopar.

            int[] sayilar1 = new int[] { 1, 2, 3 };
            int[] sayilar2 = new int[] { 10, 20, 30 };
            sayilar1    = sayilar2;
            sayilar2[0] = 1000;
            Console.WriteLine("Sayilar1[0] : " + sayilar1[0]);

            //Referans Tip - arrays,class,interface...
            // new dediğimiz zaman heap te veri oluşuyor bir de adres değeri oluşturuyor.
            // sayilar1 in adresi eşittir sayilar2 nin adresi

            Person person1 = new Person();
            Person person2 = new Person();

            person1.FirstName = "Engin";

            person2           = person1;
            person1.FirstName = "Derin";
            Console.WriteLine(person2.FirstName);

            Customer customer = new Customer();

            customer.FirstName        = "Salih";
            customer.CreditCardNumber = "1234567890";

            Employee employee = new Employee();

            employee.FirstName = "Veli";

            Person person3 = customer; // customer bir person olduğu için atama yapılabilir . miras alındığı için - person tipinden olduğu için creditcardnumber görülmez

            customer.FirstName = "Ahmet";
            Console.WriteLine(((Customer)person3).CreditCardNumber);//boxing yapıldı
            Console.WriteLine(person3.FirstName);

            PersonManager personManager = new PersonManager();

            personManager.Add(employee);
        }
示例#20
0
        static void Main(string[] args)
        {
            int sayi1 = 10, sayi2 = 20;

            sayi1 = sayi2;
            sayi2 = 100;
            Console.WriteLine(sayi1);

            int[] dizi1 = new int[] { 1, 2, 3 };
            int[] dizi2 = new int[] { 4, 5, 7 };
            dizi1    = dizi2;
            dizi2[1] = 99;
            Console.WriteLine(dizi1[1]);

            Person person1 = new Person();
            Person person2 = new Person();

            person2.FirstName = "Toprak";
            person1           = person2;
            Console.WriteLine("person1.FirstName: " + person1.FirstName);

            person2.FirstName = "Yucel";
            Console.WriteLine("person1.FirstName: " + person1.FirstName); //reference type old. sonuc değisir



            //base class'a yani temel sınıfa; miras alan sınıftan atama
            //yapabiliriz. Burada base class Person, m. alan customer veya
            //employee dir. bu arada miras alan sınıf, base'i inherit ediyor deriz

            Customer customer = new Customer();

            customer.FirstName        = "Sabri";
            customer.CreditCardNumber = "918503135";                 //boxing için

            person1 = customer;                                      //alt classlarda geçiş var..
            Console.WriteLine("person1.FirstName: " + customer.FirstName);
            Console.WriteLine(((Customer)person1).CreditCardNumber); //boxing yaptık.
                                                                     //normalde person
                                                                     //üzerinden erişemezdik

            Employee employee = new Employee();

            employee.FirstName = "Beyaz";

            PersonManager personManager = new PersonManager();

            personManager.Add(employee);
        }
示例#21
0
        static void Main(string[] args)
        {
            ////int,decimal,float,enum,boolean değer tip, value types
            //int sayi1 = 10;
            //int sayi2 = 20;

            //sayi1 = sayi2;
            //sayi2 = 100;

            //Console.WriteLine("Sayı 1 : " + sayi1); //sonuç 20

            ////arrays,class,interface... referance types
            //int[] sayilar1 = new int[] { 1, 2, 3 };
            //int[] sayilar2 = new int[] { 10, 20, 30 };

            //sayilar1 = sayilar2;
            //sayilar2[0] = 1000;

            //Console.WriteLine("sayilar1[0] = : " + sayilar1[0] ); //sonuç 1000

            Person person1 = new Person();
            Person person2 = new Person();

            person1.FirstName = "Engin";
            person2           = person1; //adres eşitlemesi
            person1.FirstName = "Derin";


            //Console.WriteLine(person2.FirstName); ismi değişir Derin yazar

            Customer customer = new Customer();

            customer.FirstName    = "Salih";
            customer.CreditNumber = "1234567890";
            Employee employee = new Employee();

            employee.FirstName = "Veli";

            Person person3 = customer;

            customer.FirstName = "Ahmet";

            //Console.WriteLine(((Customer) person3).CreditNumber);

            PersonManager personManager = new PersonManager();

            personManager.Add(employee);
            personManager.Add(customer);
        }
示例#22
0
        static void Main(string[] args)
        {
            //int,decimal,float,enum,boolean = değer tip / value types
            int sayi1 = 10;
            int sayi2 = 20;

            sayi1 = sayi2;
            sayi2 = 100;

            Console.WriteLine("Sayı 1 : " + sayi1);

            //arrays,class,interface.... referans tip / referance types
            //Değer eşitlemesi değil bellek adreslemesini eşitler böyle ikisinin de adresi aynı olur
            int[] sayilar1 = new int[] { 1, 2, 3 };
            int[] sayilar2 = new int[] { 10, 20, 30 };

            sayilar1    = sayilar2;
            sayilar2[0] = 1000;

            Console.WriteLine("Sayılar[0] = " + sayilar1[0]);

            Person person1 = new Person();
            Person person2 = new Person();

            person1.FirstName = "Engin";
            person2           = person1;
            person1.FirstName = "Derin";
            Console.WriteLine(person2.FirstName);

            Customer customer = new Customer();

            customer.FirstName        = "Salih";
            customer.CreditCardNumber = 1111111;

            Employee employee = new Employee();

            employee.FirstName = "Yasin";

            Person person3 = customer;

            Console.WriteLine(((Customer)person3).CreditCardNumber);

            Console.WriteLine("//////////////////////");

            PersonManager personManager = new PersonManager();

            personManager.Add(employee);
        }
示例#23
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            //int,decimal,float,enum,boolean-->value types

            /*We can easily see that for value type,the values of variables are not changed after the assignment on the below
             * On the other hand,References type variables(in this ex:array is a type that has a type and values) will be changed after the assignment
             */
            int number1 = 10;
            int number2 = 20;

            number1 = number2;

            number2 = 100;
            Console.WriteLine($"number1 --> {number1}");

            int[] numbers1 = new int[] { 1, 5, 7 };
            int[] numbers2 = new int[] { 3, 5, 9 };

            numbers1 = numbers2;

            numbers2[0] = 1000;
            Console.WriteLine($"numbers1[0] --> {numbers1[0]}");


            Person   person1  = new Person();
            Customer customer = new Customer();

            customer.CreditCardNumber = "1234567890";
            Person person2 = new Person();

            person1.FirstName = "Ömer";
            person2           = person1;
            //Console.WriteLine(person2.FirstName);

            person2.FirstName = "Karcan";
            //Console.WriteLine(person1.FirstName);

            Employee employee = new Employee();

            Person person3 = customer;

            customer.FirstName = "Ahmet";
            PersonManager personManager = new PersonManager();

            personManager.Add(customer);
            //Console.WriteLine($"{((Customer)person3).CreditCardNumber }");
        }
示例#24
0
        static void Main(string[] args)
        {
            ////int ,decimal,float,wnum,boolean = value types
            //int sayi1 = 10;
            //int sayi2 = 20;

            //sayi1 = sayi2;
            //sayi2 = 100;
            //Console.WriteLine("sayi 1 : " + sayi1);

            ////array , class, interface reference type
            //int[] sayilar1 = new int[] {1,2,3 };
            //int[] sayilar2 = new int[] { 10, 20, 30 };
            //sayilar1 = sayilar2;
            //sayilar2[0] = 10000;
            //Console.WriteLine("Sayılar[0]" + sayilar1[0] );


            Person person1 = new Person();
            Person person2 = new Person();

            person1.FirstName = "yaren";

            person2           = person1;//adres eşitlemesi yapıyorsun
            person1.FirstName = "büşra";

            Console.WriteLine(person2.FirstName);


            Customer customer = new Customer();

            customer.FirstName        = "eray";
            customer.CreditCardNumber = "4958454";
            Employee employee = new Employee();

            employee.FirstName = "şevval";

            Person person3 = customer;

            Console.WriteLine(person3.FirstName);

            //boxing yaptık
            //Console.WriteLine(((Customer)person3).CreditCardNumber);

            PersonManager personManager = new PersonManager();

            personManager.Add(customer);
        }
示例#25
0
        static void Main(string[] args)
        {
            ////int, decimal, float, enum, boolean value types, sadece stackde işlem döner.
            //int sayi1 = 10;
            //int sayi2 = 20;
            //sayi1 = sayi2;
            //sayi2 = 100;

            //Console.WriteLine("sayi1 = " + sayi1); // cevap 20 oluyor, değer tip

            //// arrays, classes, interface are refence type, stack ve heap de adres oluşur.

            //int[] sayilar1 = new int[]{ 1, 2, 3};
            //int[] sayilar2 = new int[]{ 10, 20, 30};

            //sayilar1 = sayilar2;
            //sayilar2[0] = 1000;
            //Console.WriteLine("sayilar1[0] = " + sayilar1[0]); // cevap 1000 oluyor, referans tip

            Person person1 = new Person();
            Person person2 = new Person();

            person1.FirstName = "Engin";
            person2           = person1;
            person1.FirstName = "Derin";
            //Console.WriteLine(person2.FirstName);

            Customer customer = new Customer();

            customer.FirstName = "Salih";

            Employe employe = new Employe();

            employe.FirstName = "Veli";


            Person person3 = customer;

            customer.FirstName    = "Ahmet";
            customer.CreditNumber = "21584681";

            //Console.WriteLine(person3.FirstName);
            //Console.WriteLine(((Customer)person3).CreditNumber); //boxing

            PersonManager personManager = new PersonManager();

            personManager.Add(employe); // customer, employee, person3 yazılabilir. Person customerin ve employenin adresini tutabiliyor.
        }
示例#26
0
        static void Main(string[] args)
        {
            ////int, decimal, float, enum, boolean value types
            //int sayi1 = 10;
            //int sayi2 = 20;

            //sayi1 = sayi2;
            //sayi2 = 100;
            //Console.WriteLine("Sayı 1: "  + sayi1);

            ////arrays, class, interface... reference types
            //int[] sayilar1 = new int[] { 1, 2, 3 };
            //int[] sayilar2 = new int[] { 10, 20, 30 };

            //sayilar1 = sayilar2;
            //sayilar2[0] = 999;

            //Console.WriteLine("Sayılar1[0]= " + sayilar1[0] );

            Person person1 = new Person();
            Person person2 = new Person();

            person1.FirstName = "Jessica";

            person2           = person1;
            person1.FirstName = "Berke";

            Console.WriteLine(person2.FirstName);


            Customer customer = new Customer();

            customer.FirstName        = "Boris";
            customer.CreditCardNumber = "123456789";

            Employee employee = new Employee();

            employee.FirstName = "Nilay";

            Person person3 = customer;
            //Console.WriteLine(person3.FirstName);
            //Console.WriteLine(((Customer)person3).CreditCardNumber);

            PersonManager personManager = new PersonManager();

            personManager.Add(employee);
        }
示例#27
0
        static void Main(string[] args)
        {
            //int sayi1 = 10;
            //int sayi2 = 20;

            //sayi1 = sayi2;

            //sayi2 = 100;

            //Console.WriteLine("Sayı 1 : " + sayi1);

            //int[] sayilar1 = new int[] { 1, 2, 3 };
            //int[] sayilar2 = new int[] { 10, 20, 30 };

            //sayilar1 = sayilar2;
            //sayilar2[0] = 1000;

            //Console.WriteLine("Sayılar1[0] : " + sayilar1[0]);


            Person person1 = new Person();
            Person person2 = new Person();

            person1.FirstName = "Mustafa";

            person2           = person1;
            person1.FirstName = "Fehmi";

            //Console.WriteLine(person2.FirstName);

            Customer customer = new Customer();

            customer.FirstName        = "Mustafa";
            customer.CreditCardNumber = "15141313219494";

            Employee employee = new Employee();

            Person person3 = customer;

            customer.FirstName = "Ahmet";

            //Console.WriteLine(((Customer)person3).CreditCardNumber);

            PersonManager personManager = new PersonManager();

            personManager.Add(employee);
        }
示例#28
0
        static void Main(string[] args)
        {
            //int, decimal, float,enum,boolen  value types
            // int sayi1 = 10;
            // int sayi2 = 20;
            // sayi1 = sayi2;

            // sayi2 = 100;

            // Console.WriteLine("Sayi 1: "+ sayi1);

            //array,class,interface referenca type
            // int[] sayilar1 = new int[] { 1, 2, 3 };
            //int[] sayilar2 = new int[] { 10, 20, 30 };

            // sayilar1 = sayilar2;
            // sayilar2[0] = 1000;

            // Console.WriteLine(sayilar1[0]);

            Person person1 = new Person();
            Person person2 = new Person();

            person1.FirstName = "Engin";

            person1           = person2;
            person1.FirstName = "Derin";

            //Console.WriteLine(person2.FirstName);

            Customer customer = new Customer();

            customer.FirstName        = "Ahmet";
            customer.CreditCardNumber = "123456789";
            Employee employee = new Employee();

            employee.FirstName = "Veli";

            Person person3 = customer;
            //boxing
            //Console.WriteLine(((Customer)person3).CreditCardNumber);

            PersonManager personmanager = new PersonManager();

            personmanager.Add(employee);
        }
示例#29
0
        static void Main(string[] args)
        {
            //   //ex for value type
            //    int sayi1 = 10;
            //    int sayi2 = 20;
            //    sayi1 = sayi2;
            //    sayi2 = 100;
            //    Console.WriteLine(sayi1);
            //    //ex for reference type
            //    int[] sayilar1 = new int[] { 1, 2, 3 };
            //    int[] sayilar2 = new int[] { 10, 20, 30 };
            //    sayilar1 = sayilar2;
            //    sayilar2[0] = 1000;
            //    Console.WriteLine(sayilar1[0]);

            Person person1 = new Person();
            Person person2 = new Person();

            person1.FirstName = "Serhat";
            person2           = person1;
            person1.FirstName = "Ceren";
            //Console.WriteLine(person2.FirstName);



            Customer customer = new Customer();

            customer.FirstName = "Gamze";
            Person person3 = customer;

            customer.FirstName = "Derin";
            //Console.WriteLine(person3.FirstName);
            Employee employee = new Employee();

            employee.FirstName = "Veli";

            //customer.CreditCardNumber = "1111 2222 3333 4444";

            //Console.WriteLine(((Customer)person3).CreditCardNumber);

            PersonManager personManager = new PersonManager();

            personManager.Add(employee);
            personManager.Add(customer);
            personManager.Add(person3);
        }
示例#30
0
        static void Main(string[] args)
        {
            //int sayi1 = 10;
            //int sayi2 = 20;

            //sayi1 = sayi2;
            //sayi2 = 100;

            //Console.WriteLine("Sayi 1 :" + sayi1);

            //int[] sayilar1 = new int[] { 1, 2, 3 };
            //int[] sayilar2 = new int[] { 10, 20, 30 };

            //sayilar1 = sayilar2;
            //sayilar2[0] = 1000;

            //Console.WriteLine("Sayilar1[0] :" + sayilar1[0]);

            Person person1 = new Person();
            Person person2 = new Person();

            person1.FirstName = "Engin";

            person2           = person1;
            person1.FirstName = "Derin";
            //Console.WriteLine(person2.FirstName);


            Customer customer = new Customer();

            customer.FirstName        = "SALİH";
            customer.CreditCardNumber = "1234567890";
            Employee employee = new Employee();

            employee.FirstName = "Veli";

            Person person3 = customer;

            customer.FirstName = "Ahmet";

            //Console.WriteLine(((Customer)person3).CreditCardNumber);

            PersonManager personManager = new PersonManager();

            personManager.Add(customer);
        }