static void Main(string[] args) { Person insan = new Person(); //intialization, insan bir intance yani obje insan.Run(); CustomerService customerService = new CustomerService(); customerService.Add(); customerService.Uptade(); customerService.Delete(); CustomerService customerService1; //customerService1.Add(); var productservice = new ProductService(); productservice.Add(); productservice.Uptade(); productservice.Delete(); //productservice.AddUptadeDelete(); EmployeeService employeeService = new EmployeeService(); //Classes.Students.Student student = new Classes.Students.Student(); Student student = new Student(); student.List(); Customer customer = new Customer(); customer.Name = "Yiğit"; customer.Surname = "Mmc"; customer.City = "Ankara"; customer.Id = 1; customer.SetAge(25); Console.WriteLine("Id: " + customer.Id + "\nName: " + customer.Name + " " + customer.Surname + "\nAge: " + customer.GetAge() + "\nCity: " + customer.City); Console.ReadLine(); }
static void Main(string[] args) // behavior: davranış { Person insan; // declaration insan = new Person(); // insan obje haline gelir. insan.Run(); CustomerService customerService = new CustomerService(); // new leme işlemine initialization denir = oluşturmak // customerService: object, instance denir. customerService.Add(); customerService.Update(); customerService.Delete(); var productService = new ProductService(); productService.Add(); productService.Update(); productService.Delete(); EmployeeService employeeService = new EmployeeService(); employeeService.List(); Customer customer = new Customer(); customer.SetName("Özcan"); Console.WriteLine(customer.GetName()); customer.Surname = "Nakkaş"; Console.WriteLine(customer.Surname); customer.Age = 35; Console.WriteLine(customer.Age); // customer.country yerine encapsulation yapılmalı. Customer customer2 = new Customer() // ; koyulmaz { Id = 2, Surname = "Nakkaş", Age = 35, City = "Ankara" }; customer2.SetName("Özcan"); var customer3 = new Customer() { Id = 3, Surname = "DeNiro", Age = 75, City = "Los Angeles" }; customer3.SetName("Robert"); string customerInfo = "ID: " + customer3.Id + "\n"; customerInfo += "Name: " + customer3.GetName() + "\n"; customerInfo += "Surname: " + customer3.Surname + "\n"; customerInfo += "Age: " + customer3.Age + "\n"; customerInfo += "City: " + customer3.City; // null bağı kopartır customer3 = null; string ad = null; // ad= ""; ile aynı şey değil. Console.WriteLine(ad); int[] sayilar = null; Console.WriteLine(customerInfo); Console.ReadLine(); }