class Person(object):
def __init__(self,name):
self.__name = name
print('Person: Constructor called')
def getName(self):
return self.__name
class Nation(object):
"""docstring for Chinese"""
def __init__(self, nation):
self.__nation = nation
print('Nation: Constructor called')
def getNation(self):
return self.__nation
class Student(Person, Nation):
def __init__(self, nation, name, score):
print('Student: Constructor called')
#super(Student, self).__init__(name) #super() only support single extend
#super().__init__(name)
Person.__init__(self,name) # 'ClassName.__init__(self)' support multiple extend
Nation.__init__(self,nation)
self.__score = score
def getScore(self):
return self.__score
person = Student('China','Rick',100)
print(person.getNation())
print(person.getName())
print(person.getScore())