def init example

This commit is contained in:
Mert Gör 🇹🇷 2023-07-01 17:20:02 +03:00
parent e06b420866
commit dd19e15c16
No known key found for this signature in database
GPG Key ID: 2100A876D55B39B9
2 changed files with 36 additions and 0 deletions

18
python-temel/def_init.py Normal file
View File

@ -0,0 +1,18 @@
class A:
def __init__(self, a):
self.a = a
def dispA(self):
print(self.a)
class B(A):
def __init__(self, a, b):
A.__init__(self, a)
self.b = b
def dispB(self):
print(self.b)
b = B(10, 20)
b.dispA()
b.dispB()

18
python-temel/def_init.py~ Normal file
View File

@ -0,0 +1,18 @@
class A:
def __init__(self, a):
self.a = a
def dispA(self):
print(self.a)
class B(A):
def __init__(self, a, b):
A.__init__(self, a)
self.b = b
def dispB(self):
print(self.b)
b = B(10, 20)
b.dispA()
b.dispB()