diff --git a/latest_chapter.txt b/latest_chapter.txt new file mode 100644 index 0000000..a8ed61f --- /dev/null +++ b/latest_chapter.txt @@ -0,0 +1 @@ +Sınıfın Öznitelikleri ve Nesnenin Örnek Öznitelikleri sayfa 219 diff --git a/python-temel/class.example.py b/python-temel/class.example.py new file mode 100644 index 0000000..359605a --- /dev/null +++ b/python-temel/class.example.py @@ -0,0 +1,15 @@ +class Student: + x = 10 # sınıf özniteliği, sınıfın bir elemanı, nesnenin değil + print(x) # sınıf özniteliği olan x kullanılıyor + + def __init__(self, name, no): + self.name = name + self.no = no + + def disp(self): + print("İsim = {}, No = {}".format(self.name, self.no)) + print("x = {}".format(Student.x)) # x değil, Student.x + +s = Student("Ali Serçe", 123) +s.disp() +print("x = {}".format(Student.x)) # x değil, Student.x