MyTetra Share
Делитесь знаниями!
multiple heritance
Время создания: 16.04.2017 11:50
Раздел: Python - PyQt5 - ООП
Запись: xintrea/mytetra_db_mcold/master/base/1492332640plbeeldkfc/text.html на raw.githubusercontent.com

class Base(object):
def __init__(self):
print("Base created")

class AnotherBase(object):
def __init__(self):
print("Another Base created")
def showMe(self):
print("& it's me!!!")



class ChildB(Base, AnotherBase): # Python смотрит слева на право по классам и выполняет первый метод класса, который найдет
def __init__(self):
super(ChildB, self).__init__()
super(ChildB, self).showMe()


ChildB()


# ----------------------
# Base created
# & it's me!!!

Так же в этом разделе:
 
MyTetra Share v.0.59
Яндекс индекс цитирования